Merge pull request #1991 from Faelysse/master
Python3 redis compatibility
This commit is contained in:
@@ -180,7 +180,7 @@ class RedisClient(object):
|
|||||||
self.r_server.incr('web2py_cache_statistics:misses')
|
self.r_server.incr('web2py_cache_statistics:misses')
|
||||||
cache_set_key = self.cache_set_key
|
cache_set_key = self.cache_set_key
|
||||||
expire_at = int(time.time() + time_expire) + 120
|
expire_at = int(time.time() + time_expire) + 120
|
||||||
bucket_key = "%s:%s" % (cache_set_key, expire_at / 60)
|
bucket_key = "%s:%s" % (cache_set_key, expire_at // 60)
|
||||||
value = f()
|
value = f()
|
||||||
value_ = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
|
value_ = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
|
||||||
if time_expire == 0:
|
if time_expire == 0:
|
||||||
@@ -196,7 +196,7 @@ class RedisClient(object):
|
|||||||
# add the key to the bucket
|
# add the key to the bucket
|
||||||
p.sadd(bucket_key, key)
|
p.sadd(bucket_key, key)
|
||||||
# expire the bucket properly
|
# expire the bucket properly
|
||||||
p.expireat(bucket_key, ((expire_at / 60) + 1) * 60)
|
p.expireat(bucket_key, ((expire_at // 60) + 1) * 60)
|
||||||
p.execute()
|
p.execute()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user