eliminating memcached's 30-day limit

后端 未结 2 1964
日久生厌
日久生厌 2021-01-12 18:25

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 allowe

相关标签:
2条回答
  • 2021-01-12 18:44

    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 讨论(0)
  • 2021-01-12 18:50

    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.

    0 讨论(0)
提交回复
热议问题