当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: ASP.NET 提供一个功能完整的缓存引擎,页面可使用该引擎通过 HTTP 请求存储和检索任意对象.缓存的生存期与应用程序的生存期相同,也就是说,当应用程序重新启动时,将重新创建缓存。
 

 

    摘要:原文:http://www.blogcn.com/user8/flier_lu/index.html?id=3024651 我们知道 clr 中 assembly 是在名为 appdomain 的逻辑空间中被载入运行的,而 appdomain 是介于操作系统层面进程和线程概念之间,同时具有线程的轻便和进程的封闭性,使用者可以通过 appdomain.createdomain 创建新的 appd......
    摘要:原文:http://www.blogcn.com/user8/flier_lu/index.html?id=3213970 状态管理本来是一件很美好的事情,嘿嘿,只可惜总是有些厂商在实现的时候考虑得不那么周全。例如 ms 在 asp 中的状态管理实现就比较烂,因为只实现了一个进程内的基于内存的状态管理,故而存在很多问题: 1.所有的 session 数据都保存在 web 服务的进程中,会造成服......


ASP.NET状态存储管理九大兵器之六(缓存)

asp.net 提供一个功能完整的缓存引擎,页面可使用该引擎通过 http 请求存储与检索任意对象.

【程序编程相关:正则表达式语法

缓存的生存期与应用程序的生存期相同,也就是说,当应用程序重新启动时,将重新创建缓存. 【推荐阅读:浅谈在ASP.NET中数据有效性校验的方

1.通过指定其键与值将项添加到缓存中 【扩展信息:ZPS 4.0.1 is Availab

将数据添加到缓存中

cache["txt"] = "a";

2.通过使用 insert(重载insert方法)方法将项添加到缓存中

cache.insert("txt", "a");

下列代码显示如何设置相对过期策略.它插入一个项,该项自上次访问后 10 分钟过期.注意

datetime.maxvalue 的使用,它表示此项没有绝对过期策略.

datetime absoluteexpiration=datetime.maxvalue;

timespan slidingexpiration=timespan.fromminutes(10);

cache.insert("txt", "a",null,

absoluteexpiration,slidingexpiration,

system.web.caching.cacheitempriority.high,null);

3.使用 add 方法将项添加到缓存中

add 方法与 insert 方法具有相同的签名,但它返回表示您所添加项的对象

datetime absoluteexpiration=datetime.maxvalue;

timespan slidingexpiration=timespan.fromminutes(10);

object  ojb=(string)cache.add("txt","a",null,

absoluteexpiration ,slidingexpiration ,

system.web.caching.cacheitempriority.high,null);

string str=(string)ojb ;

response.write(str);

结果显示是"a"

add 方法使用上没有insert 方法灵活,使用add 方法时必须提供7个参数,insert 方法重载4次,我们可

以根据需要选择适当重载方法

从缓存中取得数据

方式1:

string str=(string)cache.get("txt");

response.write(str);

方式2:

string str1=(string)cache["txt1"];

response.write(str1);

查看cache中所有数据


...   下一页
    摘要:原文:http://www.blogcn.com/user8/flier_lu/index.html?id=3270482 在使用 reflector.net 或者 rotor 源码查看 bcl 库的实现时,经常会碰到一些被标记为 internalcall 的方法。如 system.string 中用于获取字符串长度的 length 属性,实现上就是调用被标记为 internalcall 的 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE