Skip to content

Commit

Permalink
Use None as a default value (considering we now serialize results).
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBordage committed Oct 7, 2014
1 parent 194297c commit ab6152d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cachalot/monkey_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


PATCHED = False
MISS_VALUE = 'Missing cache key'


def hash_cache_key(unicode_key):
Expand Down Expand Up @@ -146,8 +145,8 @@ def delete(self, k):
def get_many(self, keys):
data = {}
for k in keys:
v = self.get(k, MISS_VALUE)
if v != MISS_VALUE:
v = self.get(k)
if v is not None:
data[k] = v
return data

Expand Down Expand Up @@ -190,9 +189,9 @@ def inner(compiler, *args, **kwargs):
return original(compiler, *args, **kwargs)

cache = get_cache()
result = cache.get(cache_key, MISS_VALUE)
result = cache.get(cache_key)

if result == MISS_VALUE:
if result is None:
result = original(compiler, *args, **kwargs)
if isinstance(result, Iterable) \
and not isinstance(result, (tuple, list)):
Expand Down

0 comments on commit ab6152d

Please sign in to comment.