From d089978b7439180bf8e4155a5b6744eb8f8f166e Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 20 Nov 2013 11:42:51 +0100 Subject: [PATCH] Revert "[entropy.db.cache] add timed expiration support for cached elements" This reverts commit 8b7c48c2d99822d154bb0cca90f41683551691ca. --- lib/entropy/db/cache.py | 12 +----------- lib/entropy/db/sql.py | 5 ++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/entropy/db/cache.py b/lib/entropy/db/cache.py index 7b7417412..1a4e84e4f 100644 --- a/lib/entropy/db/cache.py +++ b/lib/entropy/db/cache.py @@ -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() diff --git a/lib/entropy/db/sql.py b/lib/entropy/db/sql.py index 7bbc37d3f..7e8a8f7c5 100644 --- a/lib/entropy/db/sql.py +++ b/lib/entropy/db/sql.py @@ -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): """