The Caching Application Block(缓存模块)
适用场景
l 当需要频繁访问静态数据或长变化的数据
l 当适用数据库性价比低的时候
l 数据始终适用,但是从服务器获取比较困难
应用缓存
引用组件
Microsoft.Practies.EnterpriseLibrary.Common.dll
Microsoft.Practies.ServerLocation.dll
Microsoft.Practies.Unity.dll
Microsoft .Practies.Unity.Interception.dll
Microsoft.Practies.EnterpriseLibrary.Caching
Microsoft.Practies.EnterpriseLibrary.Caching.Expirations
适用示例
//创建缓存
CacheManager man = CacheFactory.GetCacheManager() as CacheManager;
man.Add("Name","Sunjipeng");
//获取缓存值
string str = man.GetData("Name") as string;
//移除缓存值
man.Remove("Name");