API Questions on Kentico API.
Version 5.x > API > Clear output cache for individual page via API View modes: 
User avatar
Member
Member
davidgoss - 7/20/2012 8:34:44 AM
   
Clear output cache for individual page via API
Hi

I'm using full page cache site-wide, and often making changes to content via the API. When I do this, I often want to clear the cache on several pages where the content might be displayed, but without clearing the output cache for the whole site. Is there a way to clear the full page cache for a single node in the API? (I'd imagine a syntax like this:)

CacheHelper.ClearFullPageCache(node)

Thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 7/22/2012 6:21:33 AM
   
RE:Clear output cache for individual page via API
Hi,

Yes, there is way to clear the full page cache (output cache) with API.

Version 5.x: CacheHelper.TouchKey(CacheHelper.FULLPAGE_KEY)

Also, please refer to Output cache dependences in version 5.x here: http://devnet.kentico.com/Blogs/Martin-Hejtmanek/June-2010/New-in-5-5--Caching-API.aspx

You can basically register your custom dependency key for each of your pages, and then touch only such key from the API which will flush the full page cache of specific page/document.

There is also web part out there on marketplace for setting full page cache dependences: http://devnet.kentico.com/Marketplace/Web-parts/FullCacheDependencies.aspx

Version 6.0: CMS.GlobalHelper.CacheHelper.ClearOutputCache(…)

Thanks,
Miro