public void RemoveCache(Type contentType, string ext = null) { if (_cache != null) { _cache.Remove(ResSettings.GetCacheKey(contentType, ext)); } }
public void SetCache(object content, Type contentType, string ext = null) { if (_cache == null) { _cache = new Dictionary <string, object>(); } _cache[ResSettings.GetCacheKey(contentType, ext)] = content; }
/// <summary> /// 移除缓存 /// </summary> /// <param name="innerKey"></param> public static void RemoveCache(string innerKey) { Dictionary <string, ItemCache> cache = ResSettings.GetCache(typeof(ResPickList)) as Dictionary <string, ItemCache>; if (cache != null && cache.ContainsKey(innerKey)) { cache.Remove(innerKey); } }
public object GetCache(Type contentType, string ext = null) { string key = ResSettings.GetCacheKey(contentType, ext); if (_cache != null && _cache.ContainsKey(key)) { return(_cache[key]); } return(null); }
public static ItemCache Cached(long pickListId) { Dictionary <string, ItemCache> cache = ResSettings.GetCache(typeof(ResPickList)) as Dictionary <string, ItemCache>; if (cache == null) { ResSettings.SetCache(cache = new Dictionary <string, ItemCache>(), typeof(ResPickList)); } foreach (var p in cache) { if (p.Value.PKID == pickListId) { return(p.Value); } } return(Cached(APBplDef.ResPickListBpl.PrimaryGet(pickListId).InnerKey)); }
public static ItemCache Cached(string innerKey) { Dictionary <string, ItemCache> cache = ResSettings.GetCache(typeof(ResPickList)) as Dictionary <string, ItemCache>; if (cache == null) { ResSettings.SetCache(cache = new Dictionary <string, ItemCache>(), typeof(ResPickList)); } if (cache.ContainsKey(innerKey)) { return(cache[innerKey]); } ItemCache itemCache = new ItemCache(APBplDef.ResPickListItemBpl.GetByPickListInnerKey(innerKey)); cache[innerKey] = itemCache; return(itemCache); }
/// <summary> /// 清除缓存 /// </summary> public static void ClearCache() { ResSettings.RemoveCache(typeof(ResPickList)); }