Esempio n. 1
0
        public override FacetContent Load(FacetsConfig2 facetsConfig)
        {
            var cacheId        = facetsConfig.GetCacheId();
            var configCacheId  = "config_{cacheId}";
            var contentCacheId = "content_{cacheId}";

            if (Cache.Exists(contentCacheId))
            {
                return(Cache.Get <FacetContent>(contentCacheId));
            }
            var facetContent = base.Load(facetsConfig);

            Cache.Set <FacetsConfig2>(configCacheId, facetsConfig);
            Cache.Set <FacetContent>(contentCacheId, facetContent);
            return(facetContent);
        }
        public override ResultContentSet Load(FacetsConfig2 facetsConfig, ResultConfig resultConfig)
        {
            var configCacheId = "config_" + facetsConfig.GetCacheId();
            var resultCacheId = "result_" + resultConfig.GetCacheId(facetsConfig);
            var viewType      = Context.Results.GetViewType(resultConfig.ViewTypeId);
            var result        = viewType.IsCachable ? Cache.Get <ResultContentSet>(resultCacheId) : null;

            if (result == null)
            {
                result = base.Load(facetsConfig, resultConfig);
                Cache.Set <FacetsConfig2>(configCacheId, facetsConfig);
                if (Context.Results.GetViewType(resultConfig.ViewTypeId).IsCachable)
                {
                    Cache.Set <ResultContentSet>(resultCacheId, result);
                }
            }
            return(result);
        }