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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lru-cache-pubsub-cache-clear-0.0.9.tar.gz.
File metadata
- Download URL: lru-cache-pubsub-cache-clear-0.0.9.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cbf37ec3d04f037803c8b3486d531e5e7c0db4bdd9181116beaed3540d74116
|
|
| MD5 |
1e772f778f3a5e7a5a1075479bb1ccf2
|
|
| BLAKE2b-256 |
e1f54b126ebf001182d24e48c78ccd0b956b77cd5f26a05c9b9d5d599837d1d6
|
File details
Details for the file lru_cache_pubsub_cache_clear-0.0.9-py3-none-any.whl.
File metadata
- Download URL: lru_cache_pubsub_cache_clear-0.0.9-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
482a2dc6e955b47bac3b5158ec1fab66b3074441645b6a27997a79606d0d6576
|
|
| MD5 |
baf9bee6567ad54cd9ebb85afb6ebcc2
|
|
| BLAKE2b-256 |
fa7825656f42308f7eeec91b0adf6dc638f2e7581e076fe7e2cbeb77c08a995c
|