diff options
| author | Thomas Güttler <hv@tbz-pariv.de> | 2015-02-11 16:00:12 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-12 10:32:26 -0500 |
| commit | e519ee1d352e0e36fcb8edc9d33ec2845f663d3a (patch) | |
| tree | fb4b2b4bac348491da252622ed8030b6041866a1 | |
| parent | d7509c52466aeffb13ccd8a86475e74fdb0e6292 (diff) | |
Clarified timeout=0 in cache docs.
| -rw-r--r-- | docs/topics/cache.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt index 5cdb18e615..ced33bbe09 100644 --- a/docs/topics/cache.txt +++ b/docs/topics/cache.txt @@ -359,11 +359,11 @@ Each cache backend can be given additional arguments to control caching behavior. These arguments are provided as additional keys in the :setting:`CACHES` setting. Valid arguments are as follows: - * :setting:`TIMEOUT <CACHES-TIMEOUT>`: The default timeout, in seconds, to use for the cache. This argument defaults to ``300`` seconds (5 minutes). You can set ``TIMEOUT`` to ``None`` so that, by default, cache keys never - expire. + expire. A value of ``0`` causes keys to immediately expire (effectively + "don't cache"). * :setting:`OPTIONS <CACHES-OPTIONS>`: Any options that should be passed to the cache backend. The list of valid options will vary @@ -745,7 +745,8 @@ The basic interface is ``set(key, value, timeout)`` and ``get(key)``:: The ``timeout`` argument is optional and defaults to the ``timeout`` argument of the appropriate backend in the :setting:`CACHES` setting (explained above). It's the number of seconds the value should be stored in the cache. Passing in -``None`` for ``timeout`` will cache the value forever. +``None`` for ``timeout`` will cache the value forever. A ``timeout`` of ``0`` +won't cache the value. If the object doesn't exist in the cache, ``cache.get()`` returns ``None``:: |
