예제 #1
0
        public bool RefreshCache(CacheEntityKey keys)
        {
            bool result     = true;
            bool lastResult = true;

            if ((keys & CacheEntityKey.Product) == CacheEntityKey.Product)
            {
                result = Call(PRODUCT);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Brand) == CacheEntityKey.Brand)
            {
                result = Call(BRAND);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Category) == CacheEntityKey.Category)
            {
                result = Call(CATEGORY);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Offer) == CacheEntityKey.Offer)
            {
                result = Call(OFFER);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Campaign) == CacheEntityKey.Campaign)
            {
                result = Call(CAMPAIGN);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Setting) == CacheEntityKey.Setting)
            {
                result = Call(SETTING);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.LargeBanner) == CacheEntityKey.LargeBanner)
            {
                result = Call(LARGE_BANNER);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Currency) == CacheEntityKey.Currency)
            {
                result = Call(CURRENCY);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Country) == CacheEntityKey.Country)
            {
                result = Call(COUNTRY);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.ShippingOption) == CacheEntityKey.ShippingOption)
            {
                result = Call(SHIPPING_OPTION);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Blog) == CacheEntityKey.Blog)
            {
                result = Call(BLOG);
            }
            if (!result)
            {
                lastResult = result;
            }
            if ((keys & CacheEntityKey.Widget) == CacheEntityKey.Blog)
            {
                result = Call(WIDGET);
            }
            if (!result)
            {
                lastResult = result;
            }

            return(lastResult);
        }
예제 #2
0
        public bool RefreshCache(CacheEntityKey keys)
        {
            var cacheManagers      = new List <ICacheManager>();
            var memoryCacheManager = _cacheManagers.FirstOrDefault(t => t.Metadata.Type == CacheManagerType.Memory);

            if (memoryCacheManager != null && memoryCacheManager.Value != null)
            {
                cacheManagers.Add(memoryCacheManager.Value);
            }
            var dacheCacheManager = _cacheManagers.FirstOrDefault(t => t.Metadata.Type == CacheManagerType.Dache);

            if (dacheCacheManager != null && dacheCacheManager.Value != null)
            {
                cacheManagers.Add(dacheCacheManager.Value);
            }

            if ((keys & CacheEntityKey.Product) == CacheEntityKey.Product)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PRICE_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.COLOUR_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Brand) == CacheEntityKey.Brand)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.BRAND_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.BRAND_CATEGORY_PATTERN_KEY);

                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PRICE_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Category) == CacheEntityKey.Category)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.CATEGORY_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.CATEGORY_FILTER_PATTERN_KEY);

                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PATTERN_KEY);
                RemoveCacheByPattern(cacheManagers, CacheKey.PRODUCT_PRICE_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Offer) == CacheEntityKey.Offer)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.OFFER_RULE_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Campaign) == CacheEntityKey.Campaign)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.LARGE_BANNER_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.LargeBanner) == CacheEntityKey.LargeBanner)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.LARGE_BANNER_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Currency) == CacheEntityKey.Currency)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.CURRENCY_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Country) == CacheEntityKey.Country)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.COUNTRY_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.CustomDictionary) == CacheEntityKey.CustomDictionary)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.CUSTOM_DICTIONARY_PATTERN_KEY);
            }

            if ((keys & CacheEntityKey.Blog) == CacheEntityKey.Blog)
            {
                RemoveCacheByPattern(cacheManagers, CacheKey.BLOG_PATTERN_KEY);
            }

            return(_cacheNotifier.RefreshCache(keys));
        }