Example #1
0
        public bool TryGetPageContent(string tcmUri, out string pageContent)
        {
            pageContent = string.Empty;

            string cacheKey = String.Format("PageContentByUri_{0}", tcmUri);

            pageContent = (string)CacheAgent.Load(cacheKey);
            if (pageContent != null)
            {
                return(true);
            }
            else
            {
                string tempPageContent = PageProvider.GetContentByUri(tcmUri);
                if (tempPageContent != string.Empty)
                {
                    pageContent = tempPageContent;
                    CacheAgent.Store(cacheKey, CacheRegion, pageContent);
                    return(true);
                }
            }


            return(false);
        }
Example #2
0
        public bool TryGetPage(string tcmUri, out IPage page)
        {
            page = null;

            string cacheKey = String.Format("PageByUri_{0}", tcmUri);


            page = (IPage)CacheAgent.Load(cacheKey);
            if (page != null)
            {
                return(true);
            }
            string tempPageContent = PageProvider.GetContentByUri(tcmUri);

            if (tempPageContent != string.Empty)
            {
                page = GetIPageObject(tempPageContent);
                if (IncludeLastPublishedDate)
                {
                    ((Page)page).LastPublishedDate = PageProvider.GetLastPublishedDateByUri(tcmUri);
                }

                CacheAgent.Store(cacheKey, CacheRegion, page);

                return(true);
            }

            return(false);
        }