Revert "[entropy.db.cache] add timed expiration support for cached elements"
This reverts commit 8b7c48c2d9.
This commit is contained in:
+1
-11
@@ -9,7 +9,6 @@
|
||||
I{EntropyRepository} caching interface.
|
||||
|
||||
"""
|
||||
import threading
|
||||
import weakref
|
||||
|
||||
from entropy.core import Singleton
|
||||
@@ -64,7 +63,7 @@ class EntropyRepositoryCacher(Singleton):
|
||||
return obj()
|
||||
return obj
|
||||
|
||||
def set(self, key, value, expiration_secs = None):
|
||||
def set(self, key, value):
|
||||
"""
|
||||
Set item in cache.
|
||||
"""
|
||||
@@ -72,12 +71,3 @@ class EntropyRepositoryCacher(Singleton):
|
||||
self.__live_cache[key] = weakref.ref(value)
|
||||
else:
|
||||
self.__live_cache[key] = value
|
||||
|
||||
if expiration_secs is not None:
|
||||
timer = threading.Timer(
|
||||
expiration_secs,
|
||||
self.__live_cache.pop,
|
||||
args = (key, None))
|
||||
timer.name = "EntropyRepositoryCacher.TimedPop"
|
||||
timer.daemon = True
|
||||
timer.start()
|
||||
|
||||
@@ -849,12 +849,11 @@ class EntropySQLRepository(EntropyRepositoryBase):
|
||||
"""
|
||||
self._live_cacher.discard(self._getLiveCacheKey())
|
||||
|
||||
def _setLiveCache(self, key, value, expiration_secs = None):
|
||||
def _setLiveCache(self, key, value):
|
||||
"""
|
||||
Save a new key -> value pair to the in-memory cache.
|
||||
"""
|
||||
self._live_cacher.set(self._getLiveCacheKey() + key,
|
||||
value, expiration_secs = expiration_secs)
|
||||
self._live_cacher.set(self._getLiveCacheKey() + key, value)
|
||||
|
||||
def _getLiveCache(self, key):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user