Page API and Caching

Posted by Community Admin on 04-Aug-2018 19:12

Page API and Caching

All Replies

Posted by Community Admin on 23-Jun-2014 00:00

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

Posted by Community Admin on 24-Jun-2014 00:00

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. 

Posted by Community Admin on 24-Jun-2014 00:00

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 .

Posted by Community Admin on 24-Jun-2014 00:00

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;

After this cycle over the collection and set the property as you would like. 

Regards,
Pavel Benov
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed