Metadata-Version: 2.1
Name: lru-cache-pubsub-cache-clear
Version: 0.0.9
Summary: redis based cache_clear() for lru_cache
Home-page: https://github.com/pglotov/lru_cache_pubsub_cache_clear
Author: Petr Glotov
Author-email: pglotov@yahoo.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown

# 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.

