1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Use cPickle in redis fact caching backend.

This commit is contained in:
Josh Drake 2014-07-19 23:41:16 -05:00 committed by Michael DeHaan
parent 917e868f65
commit 3031247492

View file

@ -17,7 +17,7 @@
from __future__ import absolute_import
import collections
import pickle
import cPickle
import sys
import time
@ -40,13 +40,13 @@ class PickledRedis(StrictRedis):
pickled_value = super(PickledRedis, self).get(name)
if pickled_value is None:
return None
return pickle.loads(pickled_value)
return cPickle.loads(pickled_value)
def set(self, name, value, *args, **kwargs):
return super(PickledRedis, self).set(name, pickle.dumps(value), *args, **kwargs)
return super(PickledRedis, self).set(name, cPickle.dumps(value), *args, **kwargs)
def setex(self, name, time, value):
return super(PickledRedis, self).setex(name, time, pickle.dumps(value))
return super(PickledRedis, self).setex(name, time, cPickle.dumps(value))
class CacheModule(BaseCacheModule):