开发者

eliminating memcached's 30-day limit

开发者 https://www.devze.com 2023-01-14 11:18 出处:网络
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

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" val开发者_JS百科ue 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.


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.


30 days is the maximum length of time for which you can specify an expiry, but if you're thinking of eliminating the expiry check altogether, would it not be simpler to set the expiry time to 0? This should mean that the data is stored until the cache is full and it's removed to allow for insertion of newer items.

From the PHP Memcache docs:

Parameter expire is expiration time in seconds. If it's 0, the item never expires (but memcached server doesn't guarantee this item to be stored all the time, it could be deleted from the cache to make place for other items).
0

精彩评论

暂无评论...
验证码 换一张
取 消