开发者

What is the lifespan of the HttpRuntime Cache (any simple alternative?)

I have been using the HttpRuntime Cache for caching simple user preferences on an in house [dasboard] asp.net app that gets used by almost 200 users daily.

I simply cache stuff such as the last query conditions, scales, options (just checkboxes dependent on other checkboxes etc.) just so that when a user closes the browser, they will be returned to the exact dashboard/report option the next time they open the browser.

I do not want to use the database to cache these values because they are "unlimited" and "dynamic".

Anyway, the HttpRunime Cahce has been working fine but now every once in a while it doesn't work on the production server. Is there any 开发者_如何转开发approach to fix this problem?


The cache is application wide - are you cacheing these items on a per user basis?

The cache will periodically die, and you have no control over this - if you need these items to persist, then DB cacheing may the only way to go.

Edit - as to the unlimited and dynamic, you could potentially store them in an XML field in the database. If you have an object where they are currently stored in the cache, it would be relatively easy to serialize/deserialize this from the DB, if the cache is empty.


There are timespan and absolute expiration settings available qhen you insert into cache, but when the app pool recycles, the cache is wiped out. Check your App Pool setting in IIS, and see how frequently it recycles.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜