开发者

Cache in ASP.NET

Cache.Insert("lstDownload", GetListDownload(), null,
             DateTime.Now.AddDays(1), TimeSpan.Zero);

When will cache be exprired? What will we 开发者_开发百科receive when cache expired?


The item will be removed from the cache in at most 24 hours from now. It might be removed earlier if the worker process needs the memory for something else, or if the server or process is restarted. After that, asking the cache for an element with key lstDownload will return null.

To improve readability of your code, consider using Cache.NoSlidingExpiration instead of TimeSpan.Zero. Both will do the very same thing, but the dedicated property provides more information about your intentions.

For an introduction to the subject, see Caching Application Data on MSDN.


It will expired after 24 hours from now. But if you do iisreset or KILL Worker process thread then it will going to expire.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜