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. 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(redis_connection=get_redis_connection(),
channel_name='CHANNEL_CACHE_CLEAR',
sleep_time=3)
@lru_cache
def get_data(key)
...
return value
Here sleep_time
is interval (in seconds) between pubsub message checks.
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2038031ba4a9f09f0201a1020d62d96803f184af56a8f2f1aa0e57d038b28350 |
|
MD5 | a803c6a6e8b0c516e3a87260a60bfd04 |
|
BLAKE2b-256 | 09406dad59ac5bb5ba606a5687b7644cccc5affc129118f3015f763f8e6dfabf |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c82e68dba4925978ace3a271255bc5d93aeef1a0f02735fad239bf9a7be46f8f |
|
MD5 | fd61e38277583baef9e6085b26c4e216 |
|
BLAKE2b-256 | 1a252ab935e237518869a319929c7a0ec86cacb3bfb56719d29abd4210e33996 |