Skip to main content

A Django cache backend with fallthrough

Project description

# django-fallthrough-cache

An implementation of Django's cache backend interface that allows you to put a
fast cache (e.g. `LocMemCache`) in front of a slower one (e.g. `PyLibMCCache`).

## Usage

The configuration below sets up 3 caches: 'locmem', 'memcache', and
'fallthrough'. The fallthrough cache will look up values in the local memory
cache, and on cache misses it will fall through to memcache.

```python
CACHES = {
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'local-memory',
'TIMEOUT': 60,
'VERSION': 1
},
'memcache': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': os.environ['MEMCACHE_HOST'],
'TIMEOUT': None,
'OPTIONS': {
'connect_timeout': 1000,
'receive_timeout': 1000000,
'send_timeout': 1000000,
'dead_timeout': 5,
},
'VERSION': 1
},
'fallthrough': {
'BACKEND': 'fallthrough_cache.FallthroughCache',
'OPTIONS': {
'cache_names': ['locmem', 'memcache']
}
}
}
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-fallthrough-cache, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django-fallthrough-cache-0.1.0.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page