消除memcached的30天限制 [英] eliminating memcached's 30-day limit

查看:73
本文介绍了消除memcached的30天限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么memcached对缓存条目的生存期设置30天的限制?

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

在我的系统中,我总是将生存期设置为30天,因为那是最大允许值.将其设置为远远大于30天的值对我的应用程序来说非常理想.

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.

是否可以将"30天"值更改为其他值?

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

我正在考虑下载memcached源并重新编译以供我自己使用.我要么将"30"更改为"300",要么完全取消该检查.如果要执行此操作,我是否要更改可能导致内存缓存故障或性能不佳的内容?我的期望是,允许项目在缓存中保留更长的时间,并且当缓存已满时,将从缓存中删除这些项目.

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天是您可以指定有效期限的最长时间,但是如果您想完全取消有效期限检查,不是吗?将到期时间设置为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.

PHP Memcache文档:

参数expire是以秒为单位的到期时间.如果为0,则该项目永不过期(但memcached服务器不保证该项目一直存储,可以将其从缓存中删除以放置其他项目).
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).

这篇关于消除memcached的30天限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆