简体   繁体   English

CacheItemPolicy-SlidingExpiration“已访问”规则?

[英]CacheItemPolicy - SlidingExpiration “Accessed” rules?

From http://msdn.microsoft.com/en-us/library/system.runtime.caching.cacheitempolicy.slidingexpiration(v=vs.110).aspx ... 来自http://msdn.microsoft.com/zh-cn/library/system.runtime.caching.cacheitempolicy.slidingexpiration(v=vs.110).aspx ...

"A span of time within which a cache entry must be accessed before the cache entry is evicted from the cache. The default is NoSlidingExpiration, meaning that the item should not be expired based on a time span." “从缓存中逐出缓存条目之前必须访问缓存条目的时间段。默认值为NoSlidingExpiration,这意味着该项目不应基于时间段过期。”

What exactly is 'accessed' ? “访问”到底是什么? Does that mean if I hit the cached item like: 这是否意味着如果我按以下方式命中了缓存的项目:

var object = cache["cachekeyname"];

It's considered to be 'accessed' ? 被视为“已访问”吗?

Or would it only be considered accessed if I actually modify the cached item? 还是仅当我实际修改了缓存的项目时才认为它被访问了?

it does mean that the cache is accessed if the following code is called: 这确实意味着如果调用以下代码,则访问缓存:

var object = cache["cachekeyname"];

Therefore if the piece of code or functionality containing the above code snippet is not called within X time since you put the object into the cache or it was last accessed it will be removed from the cache. 因此,如果自从您将对象放入高速缓存中或上次访问该对象以来,未在X时间内调用包含上述代码段的代码或功能,则将从高速缓存中删除该对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM