#9595: Add support for cache to not expire
-------------------------------------+-------------------------------------
     Reporter:  keseldude            |                    Owner:
         Type:  New feature          |  otherjacob
    Component:  Core (Cache system)  |                   Status:  new
     Severity:  Normal               |                  Version:  1.0
     Keywords:  cache timeout        |               Resolution:
    Has patch:  1                    |             Triage Stage:  Accepted
  Needs tests:  1                    |      Needs documentation:  1
Easy pickings:  0                    |  Patch needs improvement:  1
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

 Here's the currenty behavior of the cache backends when `cache.set()` is
 called with `timeout=None` explicitly:
 - memcached has `def set(..., timeout=0, ...)`, and then there's this
 line: `timeout = timeout or self.default_timeout`
 - locmem/filebased/db have `def set(..., timeout=None, ...)`, and then
 there's `if timeout is None: timeout = self.default_timeout`

 For all backends except memcached `None` is a guard value that's intended
 to be replaced by the default timeout. It isn't intended to be passed
 explicitly (even though, obviously, that works). I don't know why
 memcached is implemented differently, but as far as I can tell, the intent
 is the same.

 Docs say that the "timeout argument is optional" and never show an example
 of passing None.

 Therefore, I repeat my support in using `None` for no expiration. Negative
 integers feels like C, not Python; and once we define an API we'll be
 stuck with it for the foreseeable future.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/9595#comment:19>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to