HttpContext.Current.Cache - 什么时候这个被自动清零?什么时候、清零、HttpContext、Current

2023-09-05 22:59:24 作者:^老子就要你

在我的Web表单应用程序,我使用HttpContext.Current.Cache存储一些信息,这些不同形式的使用,以避免前往分贝每一次。

In my Web forms application I am using HttpContext.Current.Cache to store some information which different forms use to avoid going to db every time.

我的问题是,什么时候才能被清除?或者,它会一直保留,直到我删除它通过code或重新启动IIS?

My Question is, when will this get cleared? Or it will remain there until I remove it through code or restart IIS ?

推荐答案

缓存保存在内存中,直到该过程停止。

The cache is held in memory until the process is stopped.

所以,重置IIS或回收的应用程序池也将清除缓存。

So, resetting IIS or recycling the application pool would also clear the cache.