using System; using umbraco; using umbraco.interfaces; using umbraco.presentation.cache; namespace Umbraco.Web.Cache { /// /// PageCacheRefresher is the standard CacheRefresher used by Load-Balancing in Umbraco. /// /// /// If Load balancing is enabled (by default disabled, is set in umbracoSettings.config) PageCacheRefresher will be called /// everytime content is added/updated/removed to ensure that the content cache is identical on all load balanced servers /// public class PageCacheRefresher : ICacheRefresher { /// /// Gets the unique identifier of the CacheRefresher. /// /// The unique identifier. public Guid UniqueIdentifier { get { return new Guid(DistributedCache.PageCacheRefresherId); } } /// /// Gets the name of the CacheRefresher /// /// The name. public string Name { get { return "Page Refresher"; } } /// /// Refreshes all nodes in umbraco. /// public void RefreshAll() { content.Instance.RefreshContentFromDatabaseAsync(); } /// /// Not used with content. /// /// The id. public void Refresh(Guid id) { // Not used when pages } /// /// Refreshes the cache for the node with specified id /// /// The id. public void Refresh(int id) { content.Instance.UpdateDocumentCache(id); } /// /// Removes the node with the specified id from the cache /// /// The id. public void Remove(int id) { content.Instance.ClearDocumentCache(id); } } }