Hi Thomas, You are correct - if you set timeout=0, the cached value immediately expire (effectively "don't cache").
This appears to be an oversight of the documentation; the section you reference includes a discussion of the None value, but not the 0 value - a clarification would definitely be worthwhile. If you open this as a ticket, we can make sure your suggestion isn't forgotten. It would also be a very easy contribution to make - the patch would be a very simple one Yours Russ Magee %-) On Tue, Feb 10, 2015 at 4:51 PM, Thomas Güttler <h...@tbz-pariv.de> wrote: > I want the cache timeout to be configurable: > > - N --> number of seconds > - None --> cache for every > - 0 --> do not cache at all. > > I am not sure if timeout=0 really does what I want. > > I could not find it explicitly in the docs: https://docs.djangoproject. > com/en/1.7/topics/cache/#basic-usage > > I don't want to put a lot of "if default_cache_timeout==0: ...." into my > code. > > It would be nice if django would support this. This would make my code > simpler. > > Does cache.set(key, timeout=0) do no caching at all? > > If yes, shouldn't this be stated in the docs explicitly? > > Regards, > Thomas Güttler > > -- > Thomas Güttler > http://thomas-guettler.de/ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/54D9C6A3.9030506%40tbz-pariv.de. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq848%2B1yeLrh76QDJmgZPNet_s4-G%3DLe9OAM%2BxYnh%3D%2BAjZFQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.