We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6d3bed1 + 59ab6b3 commit a3b6facCopy full SHA for a3b6fac
1 file changed
17-redis-cache-decorator/cache.py
@@ -11,7 +11,7 @@ def cache(self, timeout=0):
11
def decorator(f):
12
@wraps(f)
13
def wrapped(*args, **kwargs):
14
- if timeout == 0:
+ if timeout <= 0:
15
return f(*args, **kwargs)
16
key = f.__name__
17
raw = self._redis.get(key)
@@ -20,7 +20,7 @@ def wrapped(*args, **kwargs):
20
self._redis.setex(key, timeout, json.dumps(value))
21
return value
22
else:
23
- return json.loads(raw)
+ return json.loads(raw.decode())
24
return wrapped
25
return decorator
26
0 commit comments