Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

A Django memcached backend to handle 'infinite' timeouts

Project description

A Django memcached backend to handle “infinite” timeouts (i.e., never expire an item).


  1. $ pip install django-infinite-memcached

  2. Set infinite_memcached.cache.MemcachedCache as your cache backend:

    CACHES = {
        "default": {
            "BACKEND": "infinite_memcached.cache.MemcachedCache",
            "LOCATION": "",

How to use

Either set the TIMEOUT option to 0:

    "default": {
        "BACKEND": "infinite_memcached.cache.MemcachedCache",
        "LOCATION": "",
        "TIMEOUT": 0,

Or pass timeout=0 to the low-level cache commands (e.g., set, add, etc.) to keep things from expiring.


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.



Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for django-infinite-memcached, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django-infinite-memcached-0.1.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page