Question: a region with empty dict as cached value show as NO_VALUE in region.get

Issue #114 closed
created an issue

I added a decorator to a function like this:

@region.cache_on_arguments def search(query) ....return result

that function will return an empty dict or not

In my tests when I pass query= "abc" it returns an empty dict (all good), dogpile caches it and next time i call it I get a NO_VALUE in region.get(***)

I debugged and in the second run, IDE don't enter the function so I'm using a cached value. Question is: shouldn't the region.get() show I cached an empty dict instead of NO_VALUE?

How to NOT cache empty dict/lists? thanks

Comments (5)

  1. Michael Bayer repo owner

    I don't understand why you get NO_VALUE.

    Here's a test:

    from dogpile.cache import make_region
    region = make_region().configure(
    def load_user_info(user_id):
        print "info!"
        return {}
    x = load_user_info(1)
    y = load_user_info(1)
    print x
    print y


  2. Log in to comment