A Django memcached backend to handle 'infinite' timeouts
Project description
A Django memcached backend to handle “infinite” timeouts (i.e., never expire an item).
Installation
$ pip install django-infinite-memcached
Set infinite_memcached.cache.MemcachedCache as your cache backend:
CACHES = { "default": { "BACKEND": "infinite_memcached.cache.MemcachedCache", "LOCATION": "127.0.0.1:11211", }, }
How to use
Either set the TIMEOUT option to 0:
CACHES = { "default": { "BACKEND": "infinite_memcached.cache.MemcachedCache", "LOCATION": "127.0.0.1:11211", "TIMEOUT": 0, }, }
Or pass timeout=0 to the low-level cache commands (e.g., set, add, etc.) to keep things from expiring.
Why?
Django’s default memcached backend doesn’t accept timeout values of zero, instead using the default timeout (five minutes) when zero is passed.
This cache backend overrides how timeouts are calculated so any timeout of zero is passed directly to memcached, telling memcached to never expire an item.
This has been an known issue for awhile, but concerns over backwards compatibility have prevented any fixes from taking place.
License
BSD. See LICENSE.txt.
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
File details
Details for the file django-infinite-memcached-0.1.tar.gz
.
File metadata
- Download URL: django-infinite-memcached-0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | debdd1c611d3e0c1cdb806fde90e12b8c10b8183e5602da21a00a254ea557d7c |
|
MD5 | bd0ddf4322ed743bfd4c42129935a10a |
|
BLAKE2b-256 | 42936dab288d659c62126018a001adb04aa67bca3f9c45ae07cd42258f2e73ab |