Exemple #1
0
 public void RemoveCache(Type contentType, string ext = null)
 {
     if (_cache != null)
     {
         _cache.Remove(ResSettings.GetCacheKey(contentType, ext));
     }
 }
Exemple #2
0
 public void SetCache(object content, Type contentType, string ext = null)
 {
     if (_cache == null)
     {
         _cache = new Dictionary <string, object>();
     }
     _cache[ResSettings.GetCacheKey(contentType, ext)] = content;
 }
Exemple #3
0
            /// <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);
                }
            }
Exemple #4
0
        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);
        }
Exemple #5
0
            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));
            }
Exemple #6
0
            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);
            }
Exemple #7
0
 /// <summary>
 /// 清除缓存
 /// </summary>
 public static void ClearCache()
 {
     ResSettings.RemoveCache(typeof(ResPickList));
 }