微软企业库 缓存
//创建CacheManager
CacheManager cacheManager = (CacheManager)CacheFactory.GetCacheManager();
if (string.IsNullOrEmpty((String)cacheManager.GetData("MyDataReader")))
{
//添加缓存项
cacheManager.Add("MyDataReader", "123");
}
//获取缓存项
string str = (String)cacheManager.GetData("MyDataReader");
Response.Write(str);
CacheManager cacheManager = (CacheManager)CacheFactory.GetCacheManager();
if (string.IsNullOrEmpty((String)cacheManager.GetData("MyDataReader")))
{
//添加缓存项
cacheManager.Add("MyDataReader", "123");
}
//获取缓存项
string str = (String)cacheManager.GetData("MyDataReader");
Response.Write(str);