def python_memcache_deserializer(key, value, flags):
if flags == 0:
return value
if flags & FLAG_INTEGER:
return int(value)
if flags & FLAG_LONG:
return long(value)
if flags & FLAG_PICKLE:
try:
buf = StringIO(value)
unpickler = pickle.Unpickler(buf)
return unpickler.load()
except Exception:
logging.info('Pickle error', exc_info=True)
return None
return value
评论列表
文章目录