Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Django/python, how do I set the memcache to infinite time?

cache.set(key, value, 9999999)

But this is not infinite time...

like image 311
TIMEX Avatar asked May 26 '10 22:05

TIMEX


1 Answers

From the docs:

If the value of this settings is None, cache entries will not expire.

Notably, this is different from how the expiration time works in the Memcache standard protocol:

Expiration times can be set from 0, meaning "never expire", to 30 days. Any time higher than 30 days is interpreted as a unix timestamp date

So, to set a key to never expire, set the timeout to None if you're using Django's cache abstraction, or 0 if you're using Memcache more directly.

like image 193
Chris Lawlor Avatar answered Sep 28 '22 11:09

Chris Lawlor