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.decorators 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(maxsize=1000000)
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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cbf37ec3d04f037803c8b3486d531e5e7c0db4bdd9181116beaed3540d74116 |
|
MD5 | 1e772f778f3a5e7a5a1075479bb1ccf2 |
|
BLAKE2b-256 | e1f54b126ebf001182d24e48c78ccd0b956b77cd5f26a05c9b9d5d599837d1d6 |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482a2dc6e955b47bac3b5158ec1fab66b3074441645b6a27997a79606d0d6576 |
|
MD5 | baf9bee6567ad54cd9ebb85afb6ebcc2 |
|
BLAKE2b-256 | fa7825656f42308f7eeec91b0adf6dc638f2e7581e076fe7e2cbeb77c08a995c |