Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eliminating memcached's 30-day limit

Tags:

memcached

Why does memcached impose a 30-day limit on the lifetime of cache entries?

In my system, I am always setting the lifetime to be 30 days, since that's the max allowed value. Setting it to a value much greater than 30 days would be ideal for my app.

Is there a way to change the "30-day" value to something else?

I am considering downloading the memcached source and recompiling it for my own use. I would either change the "30" to "300" or perhaps get rid of that check entirely. If I were to do this, would I be changing something that would cause memcached to malfunction or perform poorly? My expectation would be that items would be allowed to remain in the cache for longer, and they items would be removed from the cache when the cache gets full.

like image 750
Mike W Avatar asked Sep 02 '10 16:09

Mike W


People also ask

How long does memcached keep data?

The expiration time in Memcached is in seconds. For instance, the default value is 10800 seconds. But, it can have a maximum value of 2592000 seconds that is, 30 days.

How much memory do I need for memcached?

This may differ depending on the operating system or Linux distribution, but it varies between 64MB and 512MB. The more memory you can give to memcached, the better. We recommend at least 2GB, if you can afford it.

Is Memcached persistent?

When deciding whether to use Redis or Memcached a major difference between these two is data persistence. While Redis is an in-memory (mostly) data store and it is not volatile, Memcached is an in-memory cache and it is volatile.

How do you calculate memcached stats?

Using netcat This gives you extensive stats (uptime, version, HITS, MISSES, connections, evictions…) about the memcached daemon. If you wish to retrieve HITS in real-time, you can build upon this command and do the following. The number will then increase as soon as there's data coming in through the memcached daemon.


1 Answers

30 days is the limit at which we consider the time you specified to be a TTL from now.

If you want longer than 30 days, it's fine, just use an absolute time (time() + whatever).

If you want no time-based expiration, as ConroyP says, just use 0.

like image 116
Dustin Avatar answered Sep 28 '22 01:09

Dustin