我希望能够在应用程序重新启动之间维护某些对象。Application_End()无法通过HttpContext.Current.Cache访问缓存[key]
为此,我想在Global.asax Application_End()
函数中将特定的缓存项写入磁盘,并将它们重新加载回Application_Start()
。
我现在有一个缓存辅助类,它使用以下方法返回缓存值:
return HttpContext.Current.Cache[key];
问题:在Application_End()
,HttpContext.Current
为空,因为没有web请求(这是一个自动清理过程) - 因此,我无法访问.Cache[]
来检索任何要保存到磁盘的项目。
问题:在Application_End()
期间如何访问缓存项目?
**有用**也许:http://johnnycoder.com/blog/2008/12/10/c-cache-helper-class/ – 2015-08-05 15:45:30