projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8d8292f
)
Make MemoryCache picklable.
author
Josh Roesslein
<jroesslein@gmail.com>
Thu, 30 Jul 2009 19:03:09 +0000
(14:03 -0500)
committer
Josh Roesslein
<jroesslein@gmail.com>
Thu, 30 Jul 2009 19:03:09 +0000
(14:03 -0500)
tweepy/cache.py
patch
|
blob
|
blame
|
history
diff --git
a/tweepy/cache.py
b/tweepy/cache.py
index 1e1b37ece21d6c0c94cfaf4ecc33815ce001757e..9062f2284ec41a2a76266503e904a25058eeba5f 100644
(file)
--- a/
tweepy/cache.py
+++ b/
tweepy/cache.py
@@
-44,6
+44,16
@@
class MemoryCache(Cache):
self._entries = {}
self.lock = threading.Lock()
+ def __getstate__(self):
+ # pickle
+ return {'entries': self._entries, 'timeout': self.timeout}
+
+ def __setstate__(self, state):
+ # unpickle
+ self.lock = threading.Lock()
+ self._entries = state['entries']
+ self.timeout = state['timeout']
+
def _is_expired(self, entry, timeout):
return timeout > 0 and (time.time() - entry[0]) >= timeout