//Key,value,key的依赖项,过期时间(三秒后),无间隔
Cache.Insert("UserName", "Kennytian", null, DateTime.Now.AddSeconds(3),
TimeSpan.Zero);
//简单赋值
Cache["Password"] = "tiankun";
//覆盖原有值
Cache["Password"] = "abc";
//删除相应的Key
Cache.Remove("Password");
//输出Cache个数
Response.Write("<li>" + Cache.Count);
Cache.Insert("UserName", "Kennytian", null, DateTime.Now.AddSeconds(3),
TimeSpan.Zero);
//简单赋值
Cache["Password"] = "tiankun";
//覆盖原有值
Cache["Password"] = "abc";
//删除相应的Key
Cache.Remove("Password");
//输出Cache个数
Response.Write("<li>" + Cache.Count);
注:Cache是object类型,所以大家可以很方便地转换成自己想要的类型 :)