public void Process(ClearOutputCachesArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull( args.OutputCacheSites, "args.OutputCacheSites"); Log.Info(this + " : DoProcess()", this); this.DoProcess(args); if (args.OutputCacheSites.Count < 1) { Log.Info(this + " args.OutputCacheSites.Count < 1 : AbortPipeline()", this); args.AbortPipeline(); } }
protected override void DoProcess(ClearOutputCachesArgs args) { //TODO: for republish or when flags indicate, clear caches regardless if ((args.OutputCacheClearingOptions.CacheKeysMustContainOne != null && args.OutputCacheClearingOptions.CacheKeysMustContainOne.Count > 0) || (args.OutputCacheClearingOptions.CacheKeysMustNotContainAny != null && args.OutputCacheClearingOptions.CacheKeysMustNotContainAny.Count > 0)) { Log.Info(this + " : contains mismatch : return", this); return; } foreach (OutputCacheSite outputCacheSite in args.OutputCacheSites) { Log.Info(this + " : clear outut cache! for " + outputCacheSite.SiteContext.Name + " : " + Sitecore.DateUtil.IsoNow + " : " + DateUtil.ToIsoDate(DateTime.Now), this); outputCacheSite.HtmlCache.Clear(); outputCacheSite.HtmlCache.SetHtml( args.LastClearedKey, DateUtil.ToIsoDate(DateTime.Now)); } args.AbortPipeline(); }