+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Page API and Caching

Page API and Caching

4 posts, 0 answered
  1. Richard
    Richard avatar
    103 posts
    Registered:
    04 Apr 2013
    23 Jun 2014
    Link to this post

    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

  2. Richard
    Richard avatar
    103 posts
    Registered:
    04 Apr 2013
    24 Jun 2014
    Link to this post

    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. 

  3. Richard
    Richard avatar
    103 posts
    Registered:
    04 Apr 2013
    24 Jun 2014
    Link to this post

    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 .

  4. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    24 Jun 2014
    Link to this post
    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
     
4 posts, 0 answered