Show More
@@ -121,6 +121,10 b' vcs.svn.redis_conn = redis://redis:6379/' | |||
|
121 | 121 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen |
|
122 | 122 | #rc_cache.repo_object.arguments.lock_auto_renewal = true |
|
123 | 123 | |
|
124 | ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key} | |
|
125 | #rc_cache.repo_object.arguments.key_prefix = custom-prefix- | |
|
126 | ||
|
127 | ||
|
124 | 128 | ; Statsd client config, this is used to send metrics to statsd |
|
125 | 129 | ; We recommend setting statsd_exported and scrape them using Promethues |
|
126 | 130 | #statsd.enabled = false |
@@ -101,6 +101,10 b' vcs.svn.redis_conn = redis://redis:6379/' | |||
|
101 | 101 | ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen |
|
102 | 102 | #rc_cache.repo_object.arguments.lock_auto_renewal = true |
|
103 | 103 | |
|
104 | ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key} | |
|
105 | #rc_cache.repo_object.arguments.key_prefix = custom-prefix- | |
|
106 | ||
|
107 | ||
|
104 | 108 | ; Statsd client config, this is used to send metrics to statsd |
|
105 | 109 | ; We recommend setting statsd_exported and scrape them using Promethues |
|
106 | 110 | #statsd.enabled = false |
@@ -184,6 +184,9 b' class BaseRedisBackend(redis_backend.Red' | |||
|
184 | 184 | self._lock_timeout = self.lock_timeout |
|
185 | 185 | self._lock_auto_renewal = str2bool(arguments.pop("lock_auto_renewal", True)) |
|
186 | 186 | |
|
187 | self._store_key_prefix = arguments.pop('key_prefix', '') | |
|
188 | self.key_prefix = f'{self._store_key_prefix}{self.key_prefix}' | |
|
189 | ||
|
187 | 190 | if self._lock_auto_renewal and not self._lock_timeout: |
|
188 | 191 | # set default timeout for auto_renewal |
|
189 | 192 | self._lock_timeout = 30 |
@@ -243,7 +246,7 b' class BaseRedisBackend(redis_backend.Red' | |||
|
243 | 246 | |
|
244 | 247 | def get_mutex(self, key): |
|
245 | 248 | if self.distributed_lock: |
|
246 | lock_key = f'_lock_{safe_str(key)}' | |
|
249 | lock_key = f'{self._store_key_prefix}_lock_{safe_str(key)}' | |
|
247 | 250 | return get_mutex_lock( |
|
248 | 251 | self.writer_client, lock_key, |
|
249 | 252 | self._lock_timeout, |
@@ -69,11 +69,9 b' class RhodeCodeCacheRegion(CacheRegion):' | |||
|
69 | 69 | return result |
|
70 | 70 | |
|
71 | 71 | key = func_key_generator(*arg, **kw) |
|
72 | timeout = expiration_time() if expiration_time_is_callable else expiration_time | |
|
73 | log.debug('Calling cached (timeout=%s) method:`%s`', timeout, user_func.__name__) | |
|
72 | 74 | |
|
73 | timeout = expiration_time() if expiration_time_is_callable \ | |
|
74 | else expiration_time | |
|
75 | ||
|
76 | log.debug('Calling cached method:`%s`', user_func.__name__) | |
|
77 | 75 | return self.get_or_create(key, user_func, timeout, should_cache_fn, (arg, kw)) |
|
78 | 76 | |
|
79 | 77 | def cache_decorator(user_func): |
General Comments 0
You need to be logged in to leave comments.
Login now