##// 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 485 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
486 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 493 ; `cache_perms` cache for permission tree, auth TTL
490 494 ; for simplicity use rc.file_namespace backend,
@@ -512,6 +516,10 b' rc_cache.cache_perms.expiration_time = 3'
512 516 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
513 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 524 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
517 525 ; for simplicity use rc.file_namespace backend,
@@ -539,6 +547,10 b' rc_cache.cache_repo.expiration_time = 25'
539 547 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
540 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 555 ; BEAKER SESSION
544 556 ; ##############
@@ -453,6 +453,10 b' rc_cache.cache_general.expiration_time ='
453 453 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
454 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 461 ; `cache_perms` cache for permission tree, auth TTL
458 462 ; for simplicity use rc.file_namespace backend,
@@ -480,6 +484,10 b' rc_cache.cache_perms.expiration_time = 3'
480 484 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
481 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 492 ; `cache_repo` cache for file tree, Readme, RSS FEEDS
485 493 ; for simplicity use rc.file_namespace backend,
@@ -507,6 +515,10 b' rc_cache.cache_repo.expiration_time = 25'
507 515 ; auto-renew lock to prevent stale locks, slower but safer. Use only if problems happen
508 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 523 ; BEAKER SESSION
512 524 ; ##############
@@ -216,6 +216,9 b' class BaseRedisBackend(redis_backend.Red'
216 216 self._lock_timeout = self.lock_timeout
217 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 222 if self._lock_auto_renewal and not self._lock_timeout:
220 223 # set default timeout for auto_renewal
221 224 self._lock_timeout = 30
@@ -275,7 +278,7 b' class BaseRedisBackend(redis_backend.Red'
275 278
276 279 def get_mutex(self, key):
277 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 282 return get_mutex_lock(
280 283 self.writer_client, lock_key,
281 284 self._lock_timeout,
General Comments 0
You need to be logged in to leave comments. Login now