small improvements to the redis backend
jvanasco
Branch: jvanasco/dogpile.cache:feature-redis_lock_class_and_prefix
Branch: zzzeek/dogpile.cache:master
Declined
Declined pull request
closing. this is out of date, and has been implemented in a package available on pypi and github as dogpile_backend_redis_advanced (https://github.com/jvanasco/dogpile_backend_redis_advanced)
Closed by: jvanasco·2018-05-05
Since Redis testing now works better, here are some suggested features reformulated against the current master (with improved tests) for potential inclusion.
configurable lock prefix
https://bitbucket.org/zzzeek/dogpile.cache/issues/76
This preserves the default behavior of "_lock{0}", but allows for users to specify a prefix for keys [such as "lk-{0}"].
reasons include:
easier for manual audits of redis keys
shorter prefixes (redis is memory only; shaving off a few bytes over tens of thousands of entries is desirable)
avoid namespace collisions
ability to wrap a lock timeout exception in a custom class
https://bitbucket.org/zzzeek/dogpile.cache/issues/77
This allows for a wrapper class to surround a lock, for the purpose of catching LockRelease errors for logging or suppression.
reasons include:
in production environments, there are some situations in which a cache can go down before a lock is released or heavy usage can cause a lock to prematurely time-out, raising an error if there is no longer a lock OR another process has created a lock.
this wrapper allows for a graceful failure of LockRelease errors -- allowing the generated data to still be used.