Memcache maximum key expiration time

cfischer picture cfischer · Sep 13, 2009 · Viewed 76.5k times · Source

What's memcached's maximum key expiration time?

If I don't provide an expiration time and the cache gets full, what happens?

Answer

Paul D. Waite picture Paul D. Waite · Dec 1, 2009

You can set key expiration to a date, by supplying a Unix timestamp instead of a number of days. This date can be more than 30 days in the future:

Expiration times are specified in unsigned integer seconds. They can be set from 0, meaning "never expire", to 30 days (60*60*24*30). Any time higher than 30 days is interpreted as a unix timestamp date. If you want to expire an object on january 1st of next year, this is how you do that.

https://github.com/memcached/memcached/wiki/Programming#expiration

But, as you say, if you’re setting key expiration to an amount of time rather than a date, the maximum is 2,592,000 seconds, or 30 days.