Page API and Caching
Hello,
Looked around quite a bit and did bunch of digging, but not finding much for definitive actions.
What I'd like to do is go through all pages (published), and change the caching setting. I'm finding that the main consistant method I have is, 'pageNode->pageData->outputCacheProfile', if empty, is default, and if a string, then set to that caching profile, or 'noCaching'. But, is this the proper way to change the pages caching setting? Ie, flip all to default, or all to 'noCaching' etc? I'm looking for proper api's if possible
Ok, so I've narrowed down the issue and am able to resolve this (manually, will check out automatic but likely may not, we'll see what time says).
So, this was an imported project from Sitefinity 3.7 to 6.3.5000. Many pages in the backend views, SHOW that the setting for the page is 'Site default caching' profile. BUT when you check the pageData properties for a page, page.pageData.OutputCacheProfile appears as 'NULL'. Which under my current checks, is what SHOULD dictate if the page is being cached and under what property.
Fix,... go to page -> edit page -> edit 'title & properties'. Don't change ANY settings, hit save (returns to page content edit), hit save/publish (returns to page list), then run the check again, and this time instead of a null, profile is "" or string.empty therefore now the page is reported properly.
Hope this sounds good, could just be a migration issue.
Additional note, from pagelist in backend, you can go directly to 'title and propreties', scroll down, hit save (returns to page list), and the page profile is now proper .
Hi Richard,
The OutputCacheProfile is a property of the PageData object. In this sense you can directly get all the PageData objects instead of the PageNode from which to access the PageData.
You can see query examples in our Documentation:
http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/pages/querying-pages
Check this one for example:
public
IQueryable<PageData> GetLivePagesNativeAPI()
PageManager pageManager = PageManager.GetManager();
IQueryable<PageData> pages = pageManager.GetPageDataList().Where(pData => pData.Status == ContentLifecycleStatus.Live);
return
pages;