Memcache最大密钥到期时间 [英] Memcache maximum key expiration time
问题描述
memcached的最大密钥到期时间是多少?
What's memcached's maximum key expiration time?
如果我没有提供过期时间并且缓存已满,会发生什么?
If I don't provide an expiration time and the cache gets full, what happens?
推荐答案
您可以通过提供Unix时间戳(而不是几天)来将密钥过期设置为日期.该日期可能会超过30天:
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:
到期时间以无符号整数秒为单位指定.可以将其设置为0(表示永不过期")到30天(60 * 60 * 24 * 30).任何高于30天的时间都将被解释为Unix时间戳日期.如果您想在明年1月1日使某个对象过期,请按照以下步骤进行操作.
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
但是,如您所说,如果您要进行设置密钥有效期为一定的时间而不是日期,最长为259.2万秒,即30天.
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.
这篇关于Memcache最大密钥到期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!