##// END OF EJS Templates
chore(caches): cleanup cache lib and added cleanup backend
super-admin -
r5497:f4c81595 default
parent child Browse files
Show More
@@ -38,9 +38,9 b' from dogpile.cache.backends import redis'
38 from dogpile.cache.backends.file import FileLock
38 from dogpile.cache.backends.file import FileLock
39 from dogpile.cache.util import memoized_property
39 from dogpile.cache.util import memoized_property
40
40
41 from rhodecode.lib.memory_lru_dict import LRUDict, LRUDictDebug
41 from ...lib.memory_lru_dict import LRUDict, LRUDictDebug
42 from rhodecode.lib.str_utils import safe_bytes, safe_str
42 from ...lib.str_utils import safe_bytes, safe_str
43 from rhodecode.lib.type_utils import str2bool
43 from ...lib.type_utils import str2bool
44
44
45 _default_max_size = 1024
45 _default_max_size = 1024
46
46
@@ -198,6 +198,13 b' class FileNamespaceBackend(PickleSeriali'
198 def get_store(self):
198 def get_store(self):
199 return self.filename
199 return self.filename
200
200
201 def cleanup_store(self):
202 for ext in ("db", "dat", "pag", "dir"):
203 final_filename = self.filename + os.extsep + ext
204 if os.path.exists(final_filename):
205 os.remove(final_filename)
206 log.warning('Removed dbm file %s', final_filename)
207
201
208
202 class BaseRedisBackend(redis_backend.RedisBackend):
209 class BaseRedisBackend(redis_backend.RedisBackend):
203 key_prefix = ''
210 key_prefix = ''
@@ -289,7 +296,7 b' class RedisMsgPackBackend(MsgPackSeriali'
289
296
290
297
291 def get_mutex_lock(client, lock_key, lock_timeout, auto_renewal=False):
298 def get_mutex_lock(client, lock_key, lock_timeout, auto_renewal=False):
292 from rhodecode.lib._vendor import redis_lock
299 from ...lib._vendor import redis_lock
293
300
294 class _RedisLockWrapper:
301 class _RedisLockWrapper:
295 """LockWrapper for redis_lock"""
302 """LockWrapper for redis_lock"""
@@ -26,9 +26,9 b' import decorator'
26 from dogpile.cache import CacheRegion
26 from dogpile.cache import CacheRegion
27
27
28 import rhodecode
28 import rhodecode
29 from rhodecode.lib.hash_utils import sha1
29 from ...lib.hash_utils import sha1
30 from rhodecode.lib.str_utils import safe_bytes
30 from ...lib.str_utils import safe_bytes
31 from rhodecode.lib.type_utils import str2bool # noqa :required by imports from .utils
31 from ...lib.type_utils import str2bool # noqa :required by imports from .utils
32
32
33 from . import region_meta
33 from . import region_meta
34
34
General Comments 0
You need to be logged in to leave comments. Login now