示例#1
0
        public DateTime GetLastPublishedDateByUrl(string url)
        {
            LoggerService.Debug("about to retrieve last published date from provider for url {0}", LoggingCategory.Performance, url);
            DateTime dt = PageProvider.GetLastPublishedDateByUrl(url);

            LoggerService.Debug("finished retrieving last published date from provider for url {0}", LoggingCategory.Performance, url);
            return(dt);
        }
示例#2
0
        public virtual bool TryFindPage(string url, out IPage page)
        {
            LoggerService.Debug(">>TryFindPage ({0}", LoggingCategory.Performance, url);
            page = null;

            string cacheKey = CacheKeyFactory.GenerateKey(CacheRegion, url, Convert.ToString(PublicationId));

            LoggerService.Debug("about to load page from cache with key {0}", LoggingCategory.Performance, cacheKey);
            page = (IPage)CacheAgent.Load(cacheKey);
            LoggerService.Debug("finished loading page from cache with key {0}, page found = {1}", LoggingCategory.Performance, cacheKey, Convert.ToString(page != null));

            if (page != null)
            {
                if (page.Title == CacheValueNullTitle)
                {
                    page = null;
                    return(false);
                }

                LoggerService.Debug("<<TryFindPage ({0}", LoggingCategory.Performance, url);
                return(true);
            }
            else
            {
                LoggerService.Debug("about to load page content from provider with url {0}", LoggingCategory.Performance, url);
                string pageContentFromBroker = PageProvider.GetContentByUrl(url);
                LoggerService.Debug("finished loading page content from provider with url {0}, has value: {1}", LoggingCategory.Performance, url, Convert.ToString(!(string.IsNullOrEmpty(pageContentFromBroker))));

                if (string.IsNullOrEmpty(pageContentFromBroker))
                {
                    CacheAgent.Store(cacheKey, CacheRegion404, CacheValueNull);
                }
                else
                {
                    LoggerService.Debug("about to create IPage from content for url {0}", LoggingCategory.Performance, url);
                    page = GetIPageObject(pageContentFromBroker);
                    if (IncludeLastPublishedDate)
                    {
                        ((Page)page).LastPublishedDate = PageProvider.GetLastPublishedDateByUrl(url);
                    }
                    LoggerService.Debug("finished creating IPage from content for url {0}", LoggingCategory.Performance, url);
                    LoggerService.Debug("about to store page in cache with key {0}", LoggingCategory.Performance, cacheKey);
                    CacheAgent.Store(cacheKey, CacheRegion, page, new List <string> {
                        page.Id
                    });
                    LoggerService.Debug("finished storing page in cache with key {0}", LoggingCategory.Performance, cacheKey);
                    LoggerService.Debug("<<TryFindPage ({0}", LoggingCategory.Performance, url);
                    return(true);
                }
            }

            LoggerService.Debug("<<TryFindPage ({0}", LoggingCategory.Performance, url);
            return(false);
        }