LibrarySites.Banner

Sitecore Output Cache Clearing Optimization (4/8): The scavengeOutputCacheKey Pipeline | John West | Sitecore Blog

This entry about the scavengeOutputCacheKey pipeline used to trawl output caches is part of a series of blog posts about a custom approach to clearing output caches for managed sites with the Sitecore ASP.NET web Content Management System (CMS) and Experience Platform (XP). For more information, see the Resources section at the end of this blog post.

If none of the preceding processors aborts the clearOutputCaches pipeline, the TrawlOutputCacheKeys processor invokes the scavengeOutputCacheKey pipeline for each entry in each output cache indicated by a ClearSiteOutputCaches object that I hope to describe elsewhere.

Processors in the scavengeOutputCacheKey pipeline inherit from the abstract ScavengeOutputCacheKeyProcessor and implement the DoProcess method accepting an argument of type ScavengeOutputCacheKeyArgs. The TrawlOutputCacheKeys processor reuses-a single ScavengeOutputCacheKeyArgs object. Rather than aborting the pipeline, excluding ClearEntry and ResetSkip, processors in the scavengeOutputCacheKey pipeline set the Skip property of the ScavengeOutputCacheKeyArgs object to true to prevent removal of the cache entry. For efficiency, the Process() method in the base class does not invoke the DoProcess() method unless the Skip property is false.

The scavengeOutputCacheKey pipeline contains the following processors:

  • CheckLanguage: Sets the Skip property to true of the cache key indicates a language other than that published:
  • CheckMustContainOne: Sets the Skip property to true of the cache key does not include any of strings required, such as _#index.
  • CheckMustNotContainAny: Sets the Skip property to true if the cache key contains any of the strings not allowed.
  • ClearEntry: Removes the entry with the key from the output cache if the Skip property is not true.
  • ResetSkip: Sets the Skip property back to false for use by the next invocation of the pipeline.

Resources