コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resourceSet">clear all labels cache. Param not used</param>
        public static void ClearCacheByResourceSet(string resourceSet)
        {
            var cache = new CacheManager<List<ResLabel>>(CacheKeyPrefix);

            //last update 20150324
            //if (!cache.IsEmpty(resourceSet){}

            cache.Clear();
        }
コード例 #2
0
        public static List<ResLabel> GetLabelsByResourceSet(string resourceSet)
        {
            var result = new List<ResLabel>();

            var cache = new CacheManager<List<ResLabel>>(CacheKeyPrefix);
            if (cache.IsEmpty(resourceSet))
            {
                var man = new LabelsManager();
                var filter = new LabelsFilter();
                filter.ResourceSet = resourceSet;
                result = man.GetByFilter(filter, "");

                cache.Insert(resourceSet, result);
            }
            else
            {
                result = cache.GetValue(resourceSet);
            }
            return result;
        }
コード例 #3
0
        private static List<ResLabel> getLabelsByResourceId(string resourceSet, string resourceId)
        {
            var result = new List<ResLabel>();

            var cache = new CacheManager<List<ResLabel>>(CacheKeyPrefix);
            string key = resourceSet + "_" + resourceId;
            if (cache.IsEmpty(key))
            {
                var man = new LabelsManager();
                var filter = new LabelsFilter();
                filter.ResourceSet = resourceSet;
                filter.ResourceId = resourceId;
                result = man.GetByFilter(filter, "");

                cache.Insert(key, result);
            }
            else
            {
                result = cache.GetValue(key);
            }
            return result;
        }