Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django - Persistant cache

Is there a way I can set a cache key indefinitely using the default django cache framework? I tried setting the timeout to 0, but that doesn't set the key at all unfortunately.

like image 285
Hanpan Avatar asked Feb 12 '11 16:02

Hanpan


2 Answers

Django 1.6 now accepts None for the timeout argument to specify forever.

https://docs.djangoproject.com/en/dev/topics/cache/#basic-usage

like image 155
Matt Avatar answered Oct 06 '22 23:10

Matt


Someone recently mentioned Johnny Cache in an unrelated answer. It provides a infinite caching locmem and memcached backend when a timeout of 0 is provided.

like image 32
Filip Dupanović Avatar answered Oct 07 '22 00:10

Filip Dupanović