/// <summary> /// 获取文件依赖的缓存数据 /// </summary> /// <typeparam name="T">返回的数据类型</typeparam> /// <param name="keyword">缓存关键字</param> /// <param name="handler">生成缓存数据的委托</param> /// <param name="filePath">文件依赖的路径</param> /// <returns></returns> public T GetInstance <T>(string keyword, CreateInstanceHandler2 <T> handler, params string[] filePath) where T : class { keyword = preCacheKey + keyword; if (!cacheKeyList.Contains(keyword)) { cacheKeyList.Add(keyword); } return(We7Utils.GetCacheInstance <T>(keyword, handler, filePath)); }
/// <summary> /// 获取缓存数据 /// </summary> /// <typeparam name="T">返回的数据类型</typeparam> /// <param name="keyword">缓存关键字</param> /// <param name="handler">生成缓存数据的委托</param> /// <returns></returns> public T GetInstance <T>(string keyword, CreateInstanceHandler <T> handler, int timeout) where T : class { keyword = preCacheKey + keyword; if (!cacheKeyList.Contains(keyword)) { cacheKeyList.Add(keyword); } return(We7Utils.GetCacheInstance <T>(keyword, handler, timeout)); }
/// <summary> /// 获取缓存数据 /// </summary> /// <typeparam name="T">返回的数据类型</typeparam> /// <param name="keyword">缓存关键字</param> /// <param name="handler">生成缓存数据的委托</param> /// <returns></returns> public T GetInstance <T>(string keyword, CreateInstanceHandler <T> handler) where T : class { keyword = preCacheKey + keyword; if (!cacheKeyList.Contains(keyword)) { cacheKeyList.Add(keyword); } if (defaultTimeout == -1) { return(handler != null?handler() : default(T)); } else if (defaultTimeout == 0) { return(We7Utils.GetCacheInstance <T>(keyword, handler)); } else { return(We7Utils.GetCacheInstance <T>(keyword, handler, defaultTimeout)); } }