incr如何与到期时间一起工作? [英] How does incr work with expiry times?
问题描述
在memcached(appengine api实现)中,到期如何与incr()交互?没有incr()的时间参数,但是如果我在另一个调用中添加了键,会发生什么情况 而不是使用initial_value参数,就像这样:
In memcached (appengine api implementation), how does expiration interact with incr()? There isn't a time argument for incr(), but what happens if I add the key with another call rather than using the initial_value param, like so:
memcache.add('testcounter', 0, time=60*90)
newcnt = memcache.incr('testcounter')
测试计数器仍会在90分钟后过期吗?我是否在那个时候再次打过电话?
will testcounter still expire in 90 minutes? Whether or not I call this again in that time?
推荐答案
"The app can provide an expiration time when a value is stored, as either a number of seconds relative to when the value is added, or as an absolute Unix epoch time in the future (a number of seconds from midnight January 1, 1970). The value will be evicted no later than this time, though it may be evicted for other reasons." it doesn't mention modifications.
如果您在google.appengine.api.memcache.init.py中查看内存缓存的代码,您会发现在incr或_incrdecr中都没有调用set_expiration_time函数
If you look at the code of memcache in google.appengine.api.memcache.init.py you'll see that neither in incr or in _incrdecr there is a call to the set_expiration_time function
这篇关于incr如何与到期时间一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!