Skip to content

Commit

Permalink
properly cache empty lists and return them from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoor committed Jan 20, 2011
1 parent fb16931 commit 920e535
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions memcache_memoize.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
def _CachedLookup(name, ttl, function, other, args):
cache_key = ":".join([APP_VERSION, name] + [str(x) for x in args])
data = memcache.get(cache_key)
if data:
if data is not None:
return data

data = function(other, *args)
if data:
if data is not None:
memcache.add(cache_key, data, ttl)
return data

Expand Down

0 comments on commit 920e535

Please sign in to comment.