Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

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.



Release History

This version
History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(2.3 kB) Copy SHA256 Hash SHA256
Source Nov 12, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting