Jahia Dev Forum > cache clean for...

0 (0 Good)
0 (0 Bad)

cache clean for page from code

by  bharatkasodariya »  2017/06/06 11:02

Is it possible to clean cache of any page from jahia api. or to flush all cache of entire jahia site.

  • cache clean for page from code
    2017/06/06 11:02

    bharatkasodariya <p>Is it possible to clean cache of any page from jahia api. or to flush all cache of entire jahia site.</p>

  • Number of messages  57
    Registration date Jun 6, 2017
    0 (0 Good)
    0 (0 Bad)

    Re: cache clean for page from code

    by  shyrkov »  2017/06/21 12:26

    Hello,

    yes, the API to use in both cases is:

    org.jahia.services.cache.CacheHelper.flushOutputCachesForPath(String, boolean)

    i.e.:

    CacheHelper.flushOutputCachesForPath("/sites/mySite/home/about-us", true) - will flush output caches for the about-us page and sub-pages

    CacheHelper.flushOutputCachesForPath("/sites/mySite", true) - will flush output caches for the whole site

    Kind regards

    Sergiy

  • Re: cache clean for page from code
    2017/06/21 12:26

    shyrkov <p>Hello,</p> <p>yes, the API to use in both cases is:</p> <p>org.jahia.services.cache.CacheHelper.flushOutputCachesForPath(String, boolean)</p> <p>i.e.:</p> <p>CacheHelper.flushOutputCachesForPath(&quot;/sites/mySite/home/about-us&quot;, true) - will flush output caches for the about-us page and sub-pages</p> <p>CacheHelper.flushOutputCachesForPath(&quot;/sites/mySite&quot;, true) - will flush output caches for the whole site</p> <p>Kind regards</p> <p>Sergiy</p>

  • Number of messages  407
    Registration date Jun 21, 2017
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page