/// <summary> /// Adds the cache dependency keys to the output cache /// </summary> /// <param name="Dependencies">The Dependencies</param> public static void AddCacheDependencies(string[] Dependencies) { foreach (string Dependency in Dependencies) { CacheHelper.EnsureDummyKey(Dependency); } CacheHelper.AddOutputCacheDependencies(Dependencies); }
protected override void OnPreRender(EventArgs e) { if (StopProcessing) { // Do nothing } else { if (PortalContext.ViewMode.IsLiveSite() && (CacheDependencies != "")) { base.OnPreRender(e); // Use default cache dependencies if (UseDefaultDependencies) { DocumentContext.AddDefaultOutputCacheDependencies(); } // More than one dependency is set string[] dependencies = CacheHelper.GetDependencyCacheKeys(CacheDependencies); CacheHelper.AddOutputCacheDependencies(dependencies); } } }
protected override void OnPreRender(EventArgs e) { if (StopProcessing) { // Do nothing } else { if ((CMSContext.ViewMode == ViewModeEnum.LiveSite) && (CacheDependencies != "")) { base.OnPreRender(e); // Use default cache dependencies if (UseDefaultDependencies) { CMSContext.AddDefaultOutputCacheDependencies(); } // More than one dependency is set string[] dependencies = CacheDependencies.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); CacheHelper.AddOutputCacheDependencies(dependencies); } } }
// Sadly a little stuck with this one, need to call from Shared layout View so can't use AutoFac /// <summary> /// Adds the cache dependency key to the output cache /// </summary> /// <param name="Dependency">The Dependency Key</param> public static void AddCacheDependency(string Dependency) { CacheHelper.EnsureDummyKey(Dependency); CacheHelper.AddOutputCacheDependencies(new string[] { Dependency }); }