caches: added reprs

This commit is contained in:
Marcin Kuzminski 2019-09-22 18:02:28 +02:00
parent fe04abfe15
commit 08399d7563
2 changed files with 5 additions and 2 deletions

View file

@ -161,6 +161,9 @@ class FileNamespaceBackend(PickleSerializer, file_backend.DBMBackend):
arguments['lock_factory'] = CustomLockFactory
super(FileNamespaceBackend, self).__init__(arguments)
def __repr__(self):
return '{} `{}`'.format(self.__class__, self.filename)
def list_keys(self, prefix=''):
prefix = '{}:{}'.format(self.key_prefix, prefix)

View file

@ -60,7 +60,7 @@ class RhodeCodeCacheRegion(CacheRegion):
def get_or_create_for_user_func(key_generator, user_func, *arg, **kw):
if not condition:
log.debug('Calling un-cached func:%s', user_func)
log.debug('Calling un-cached func:%s', user_func.func_name)
return user_func(*arg, **kw)
key = key_generator(*arg, **kw)
@ -68,7 +68,7 @@ class RhodeCodeCacheRegion(CacheRegion):
timeout = expiration_time() if expiration_time_is_callable \
else expiration_time
log.debug('Calling cached fn:%s', user_func)
log.debug('Calling cached fn:%s', user_func.func_name)
return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw))
def cache_decorator(user_func):