refactored pickle everywhere but Session, removed unused imports

This commit is contained in:
niphlod
2014-09-10 19:12:10 +02:00
parent c3cd32cc4f
commit 6403878f95
10 changed files with 42 additions and 33 deletions
+5 -2
View File
@@ -6,7 +6,10 @@ import redis
from redis.exceptions import ConnectionError
from gluon import current
from gluon.cache import CacheAbstract
import cPickle as pickle
try:
import cPickle as pickle
except:
import pickle
import time
import re
import logging
@@ -165,7 +168,7 @@ class RedisClient(object):
expireat = int(time.time() + time_expire) + 120
bucket_key = "%s:%s" % (cache_set_key, expireat / 60)
value = f()
value_ = pickle.dumps(value)
value_ = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
if time_expire == 0:
time_expire = 1
self.r_server.setex(key, value_, time_expire)