incr如何与到期时间一起工作? [英] How does incr work with expiry times?

查看:227
本文介绍了incr如何与到期时间一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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?

推荐答案

该应用可以在存储值时提供到期时间,可以是相对于添加值时的秒数,也可以是将来的绝对Unix时期( (从1970年1月1日午夜开始的秒数).尽管可能由于其他原因而将其清除,但该值将不迟于这次被撤除." 它没有提到修改.

"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屋!

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