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
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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b5694a65a614f7c069cddb6561c45555674e8cbedba618c314cbd3b1ea2773 |
|
MD5 | 366e3a9fc010f9ee5a8b3ae5c593885e |
|
BLAKE2b-256 | 4c06b6d506f7a61d9d390632581652630761b4534644a78fbe429c1179d3e666 |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bf5ec99da1068f5afd49fd5f419bacc631228e37a7049e27f6b173a41927318 |
|
MD5 | 4faf1564821603219f830492f4295db4 |
|
BLAKE2b-256 | 0810451291dc48e97096c07ddba41e35cab18e3cb557596944eeab7440662fd1 |