##// END OF EJS Templates
caches: improve logging
super-admin -
r5579:54bb9264 default
parent child Browse files
Show More
@@ -69,19 +69,17 b' class RhodeCodeCacheRegion(CacheRegion):'
69 def get_or_create_for_user_func(func_key_generator, user_func, *arg, **kw):
69 def get_or_create_for_user_func(func_key_generator, user_func, *arg, **kw):
70
70
71 if not condition:
71 if not condition:
72 log.debug('Calling un-cached method:%s', user_func.__name__)
72 log.debug('Calling un-cached method:`%s`', user_func.__name__)
73 start = time.time()
73 start = time.time()
74 result = user_func(*arg, **kw)
74 result = user_func(*arg, **kw)
75 total = time.time() - start
75 total = time.time() - start
76 log.debug('un-cached method:%s took %.4fs', user_func.__name__, total)
76 log.debug('Call for un-cached method:`%s` took %.4fs', user_func.__name__, total)
77 return result
77 return result
78
78
79 key = func_key_generator(*arg, **kw)
79 key = func_key_generator(*arg, **kw)
80 timeout = expiration_time() if expiration_time_is_callable else expiration_time
81 log.debug('Calling cached (timeout=%s) method:`%s`', timeout, user_func.__name__)
80
82
81 timeout = expiration_time() if expiration_time_is_callable \
82 else expiration_time
83
84 log.debug('Calling cached method:`%s`', user_func.__name__)
85 return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw))
83 return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw))
86
84
87 def cache_decorator(user_func):
85 def cache_decorator(user_func):
General Comments 0
You need to be logged in to leave comments. Login now