private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (!applyMemCached) { //检查并移除相应的缓存项 instance = CachesFileMonitor.CheckAndRemoveCache(instance); } }
/// <summary> /// 单体模式返回当前类的实例 /// </summary> /// <returns></returns> public static ShopCache GetCacheService() { if (instance == null) { lock (lockHelper) { if (instance == null) { instance = applyMemCached ? new ShopCache() : CachesFileMonitor.CheckAndRemoveCache(new ShopCache()); } } } return(instance); }