##// END OF EJS Templates
feat(redis): added ability to specify a redis key prefix for all cache regions of dogpile that use redis backend
super-admin -
r5582:15d02bff default
parent child Browse files
Show More
@@ -485,6 +485,10 b' rc_cache.cache_general.expiration_time ='
485 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
485 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
486 #rc_cache.cache_general.arguments.lock_auto_renewal = true
486 #rc_cache.cache_general.arguments.lock_auto_renewal = true
487
487
488 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
489 #rc_cache.cache_general.arguments.key_prefix = custom-prefix-
490
491
488 ; *************************************************
492 ; *************************************************
489 ; `cache_perms` cache for permission tree, auth TTL
493 ; `cache_perms` cache for permission tree, auth TTL
490 ; for simplicity use rc.file_namespace backend,
494 ; for simplicity use rc.file_namespace backend,
@@ -512,6 +516,10 b' rc_cache.cache_perms.expiration_time = 3'
512 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
516 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
513 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
517 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
514
518
519 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
520 #rc_cache.cache_perms.arguments.key_prefix = custom-prefix-
521
522
515 ; ***************************************************
523 ; ***************************************************
516 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
524 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
517 ; for simplicity use rc.file_namespace backend,
525 ; for simplicity use rc.file_namespace backend,
@@ -539,6 +547,10 b' rc_cache.cache_repo.expiration_time = 25'
539 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
547 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
540 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
548 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
541
549
550 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
551 #rc_cache.cache_repo.arguments.key_prefix = custom-prefix-
552
553
542 ; ##############
554 ; ##############
543 ; BEAKER SESSION
555 ; BEAKER SESSION
544 ; ##############
556 ; ##############
@@ -453,6 +453,10 b' rc_cache.cache_general.expiration_time ='
453 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
453 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
454 #rc_cache.cache_general.arguments.lock_auto_renewal = true
454 #rc_cache.cache_general.arguments.lock_auto_renewal = true
455
455
456 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
457 #rc_cache.cache_general.arguments.key_prefix = custom-prefix-
458
459
456 ; *************************************************
460 ; *************************************************
457 ; `cache_perms` cache for permission tree, auth TTL
461 ; `cache_perms` cache for permission tree, auth TTL
458 ; for simplicity use rc.file_namespace backend,
462 ; for simplicity use rc.file_namespace backend,
@@ -480,6 +484,10 b' rc_cache.cache_perms.expiration_time = 3'
480 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
484 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
481 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
485 #rc_cache.cache_perms.arguments.lock_auto_renewal = true
482
486
487 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
488 #rc_cache.cache_perms.arguments.key_prefix = custom-prefix-
489
490
483 ; ***************************************************
491 ; ***************************************************
484 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
492 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
485 ; for simplicity use rc.file_namespace backend,
493 ; for simplicity use rc.file_namespace backend,
@@ -507,6 +515,10 b' rc_cache.cache_repo.expiration_time = 25'
507 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
515 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
508 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
516 #rc_cache.cache_repo.arguments.lock_auto_renewal = true
509
517
518 ; prefix for redis keys used for this cache backend, the final key is constructed using {custom-prefix}{key}
519 #rc_cache.cache_repo.arguments.key_prefix = custom-prefix-
520
521
510 ; ##############
522 ; ##############
511 ; BEAKER SESSION
523 ; BEAKER SESSION
512 ; ##############
524 ; ##############
@@ -216,6 +216,9 b' class BaseRedisBackend(redis_backend.Red'
216 self._lock_timeout = self.lock_timeout
216 self._lock_timeout = self.lock_timeout
217 self._lock_auto_renewal = str2bool(arguments.pop("lock_auto_renewal", True))
217 self._lock_auto_renewal = str2bool(arguments.pop("lock_auto_renewal", True))
218
218
219 self._store_key_prefix = arguments.pop('key_prefix', '')
220 self.key_prefix = f'{self._store_key_prefix}{self.key_prefix}'
221
219 if self._lock_auto_renewal and not self._lock_timeout:
222 if self._lock_auto_renewal and not self._lock_timeout:
220 # set default timeout for auto_renewal
223 # set default timeout for auto_renewal
221 self._lock_timeout = 30
224 self._lock_timeout = 30
@@ -275,7 +278,7 b' class BaseRedisBackend(redis_backend.Red'
275
278
276 def get_mutex(self, key):
279 def get_mutex(self, key):
277 if self.distributed_lock:
280 if self.distributed_lock:
278 lock_key = f'_lock_{safe_str(key)}'
281 lock_key = f'{self._store_key_prefix}_lock_{safe_str(key)}'
279 return get_mutex_lock(
282 return get_mutex_lock(
280 self.writer_client, lock_key,
283 self.writer_client, lock_key,
281 self._lock_timeout,
284 self._lock_timeout,
General Comments 0
You need to be logged in to leave comments. Login now