Revert "[entropy.db.cache] add timed expiration support for cached elements"

This reverts commit 8b7c48c2d9.
This commit is contained in:
Fabio Erculiani
2013-11-20 11:42:51 +01:00
parent d786c403c8
commit d089978b74
2 changed files with 3 additions and 14 deletions
+1 -11
View File
@@ -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()
+2 -3
View File
@@ -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):
"""