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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59dc821ee3736f7b88c3e33273f014c904dbe9401aad5f22da7e64692ff86b3b |
|
MD5 | a97848f0c5f8d03768776e4c42652df5 |
|
BLAKE2b-256 | c3154eb9aa4490232643b98e15e3d7125ff45d9cef67ec78f0a2d52d6e1dd1df |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a07c52a13f930a7a709c6f412f2f281dbbd39d74bfefd81c1b4d4dbd7acfe64 |
|
MD5 | 29d6e8d5c93f73f364321f194b45ee7a |
|
BLAKE2b-256 | b167fc8112ac55a532805b63783672ae0073561a93aece860445872e45a2436c |