Example #1
0
        public async Task <ExpandoObject> GetSitemapAsync(ICurrentRequest currentRequest)
        {
            var cacheItemValue =
                await _dataFactory.CacheRepository.GetValueAsync <ExpandoObject>(currentRequest, "Sitemap");

            if (cacheItemValue == null)
            {
                var sitemap = await _cacheProvider.GetSiteMapAsync(currentRequest);

                var cacheItem = new CacheItem();
                cacheItem.Value      = JsonConvert.SerializeObject(sitemap);
                cacheItem.Key        = JsonConvert.SerializeObject(currentRequest);
                cacheItem.Type       = "Sitemap";
                cacheItem.SiteId     = currentRequest.SiteId;
                cacheItem.CreateDate = DateTime.Now;
                await _dataFactory.CacheRepository.SaveAsync(cacheItem);

                return(sitemap);
            }
            // cacheItem.MasterJson
            //Json. ExpandoObject
            return(cacheItemValue);
        }