redis based cache_clear() for lru_cache
Project description
lru_cache_pubsub_cache_clear
lru_cache_pubsub_cache_clear
is a decorator to broadcast cache_clear()
calls to lru_cache
across
multiple instances of an application. This allows for local cache access speed and redis-like centralized cache invalidation. Example:
from lru_cache_pubsub_cache_clear import lru_cache_pubsub_cache_clear
from django_redis import get_redis_connection
@lru_cache_pubsub_cache_clear(get_redis_connection=get_redis_connection,
channel_name='CHANNEL_CACHE_CLEAR')
@lru_cache
def get_data(key)
...
return value
Here get_redis_connection
is a callable which returns a redis connection (e.g. django_redis.get_redis_connection
).
Then every time one of app instances calls get_data.cache_clear()
it will be executed on all connected instances.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lru-cache-pubsub-cache-clear-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1df5a33dfb0d0dd9d6901dd7ffc0aa400dbc272154d174c61de787b70c4bbe9e |
|
MD5 | 85e4e46ed018051609c51804ff1132bf |
|
BLAKE2b-256 | 79cda47d3a219778bab6dc3dcabe311427387bf670f8d1c94bf3af1d1b5f2cf0 |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fb4b7291c9581fc062a044b8b0028e469525db9477da1a64f771eba18e9da09 |
|
MD5 | 9a2dad5b7f860a2595dd85cfd48c6cb2 |
|
BLAKE2b-256 | 9d5425bb3decfe784454e30cf2fc02e0596bfa98847e34e224623ddc0a79f7a4 |