使用Cache缓存

存放位置:服务器内存,用于频繁访问且不轻易更改的内容缓存。

  

string CacheKey = "CT1"; //检索指定项,
object objModel = Cache.Get(CacheKey);
if (objModel == null)
{
objModel = "插入值";
Cache.Insert(CacheKey, objModel, null, DateTime.Now.AddMinutes(120), System.Web.Caching.Cache.NoSlidingExpiration);
} //缓存120分钟

  

原文地址:https://www.cnblogs.com/LoveTX/p/4278813.html