django/django — pull request #2365 by zedr (2014-02-23 23:57:02+00:00)
Title: Fixed #22085 - Added a feature that allows the Cache settings argument to be None, for "no timeout".

Django 1.6 introduced a feature that allows the passing of `None` as the `timeout` argument when setting a cache key, using the Django caching framework. This is interpreted as "no timeout", so the cache object will set a non-expirable key as the default, unless a different value for the timeout is passed.

However, if the TIMEOUT was set in the settings file, the default timeout was still 300 seconds.

Ticket #22085 was opened to address this, and was accepted as a new feature.

This fix implements the feature, and adds four new tests specific to this case.

To set a never-expiring timeout for cache keys as the default behaviour, simply define the CACHES setting in this way:

```python

CACHES = {
"default": {
# define the backend here...

# set the timeout to None, meaning "no timeout".
TIMEOUT = None
}
}
```
Now, by default behavior of the Cache instances will be to set non-expiring keys ("cache forever").

For more information, see ticket: https://code.djangoproject.com/ticket/22085