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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e0c85adadc58c0b536cd6bbce5bdc29990aec1c509334d12157ad9495b94929 |
|
MD5 | e41fb988140e70e7aebe9c9d041991bf |
|
BLAKE2b-256 | a554b894664f0ec6a88805a1cece82cc4d4bf9c28d383e22facfc6d9c7f5fa26 |
Close
Hashes for lru_cache_pubsub_cache_clear-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f4556e212ad9c7cfc6514562de36e305c6045d66f96884edfe7dea23e546a8c |
|
MD5 | 157a22fbfaf95b59a4137e33978b7994 |
|
BLAKE2b-256 | 0f84c2d3b292fe3f0b0bc8db6008d4ea8ddb66de02f9722fcc6dde094f08d49b |