using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Caching; using System.Text; using System.Threading.Tasks; namespace AutoLogisticsPH.Common.Utils { /// <summary> /// 基于MemoryCache(内存缓存)的缓存工具类 /// Author:左文俊 ///…
MemoryCache缓存 ---缓存时效测试 var cachePool = new MyCachePool(); //Thread.Sleep(1000); var value = cachePool.GetFileValue(); /// <summary> /// MemoryCache缓存 /// </summary> public class MyCachePool { ObjectCache cache = MemoryCache.Default; const str…
1 借鉴这篇文章 https://www.cnblogs.com/zuowj/p/8440902.html using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.Caching; using System.Diagnostics; namespace ConsoleApp1 {…
Single instance of a MemoryCache across multiple application pools on the same server [duplicate] You could create a separate Web Api project and host your implementation of the MemoryCache there. Then expose an api that gets / sets items from the ca…