asp.net – HttpContext.Cache到期
发布时间:2020-12-15 19:12:38 所属栏目:asp.Net 来源:网络整理
导读:有没有办法指定在HttpContext.Cache中保存数据的时间? 解决方法 您可以在Cache.Add()的第4个参数中指定它: public Object Add( string key,Object value,CacheDependency dependencies,DateTime absoluteExpiration,// After this DateTime,it will be rem
有没有办法指定在HttpContext.Cache中保存数据的时间?
解决方法
您可以在Cache.Add()的第4个参数中指定它:
public Object Add( string key,Object value,CacheDependency dependencies,DateTime absoluteExpiration,// After this DateTime,it will be removed from the cache TimeSpan slidingExpiration,CacheItemPriority priority,CacheItemRemovedCallback onRemoveCallback ) 编辑: 如果您通过索引器访问缓存(即Cache [“Key”]),被调用的方法不使用到期,并且无限期地保留在缓存中。 这里是使用索引器时调用的代码: public void Insert(string key,object value) { this._cacheInternal.DoInsert(true,key,value,null,NoAbsoluteExpiration,NoSlidingExpiration,CacheItemPriority.Normal,true); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 跟踪间歇性“对象引用未设置为对象的实例”.构建
- asp.net – 如何绑定一个MemoryStream到asp:图像控件?
- asp.net-mvc – 在BaseController中获取/设置HttpContext会
- asp.net-core – 基于策略的授权可以更加动态吗?
- asp.net – 具有w3wp应用程序池IIS 7的高内存使用率
- asp.net-mvc – 如何在客户端Kendo UI网格中实现服务器端分
- .net – vNext是完全“基于约定的编程”吗?
- asp.net-mvc – 以Razor语法为Telerik MVC Grid定义一个Tem
- ASP.Net将文件下载到客户端浏览器
- VS2015如何创建单元测试并启动调试
推荐文章
站长推荐
- asp.net-mvc – 具有错误的剃刀语法编译时不应该
- asp.net-mvc – 带tab-id的RedirectToAction()
- asp.net – 浏览器的缓存是否考虑了URL中的参数?
- asp-classic – 你用什么来编辑和开发经典ASP
- asp.net – 如何在SSRS公式字段中按两个日期计算
- asp.net-mvc – ASP.NET MVC Action被调用两次
- 什么时候在asp.net WebService中调用Application
- asp.net-mvc – PRG模式是否与AJAX表单帖子不兼容
- asp.net – 使用Mono的Linux上的ActiveX?
- asp.net-mvc – 使用WCF进行ASP表单身份验证?
热点阅读