Class DistributedCache
Represents the entry point into Umbraco's distributed cache infrastructure.
Inheritance
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public sealed class DistributedCacheRemarks
The distributed cache infrastructure ensures that distributed caches are invalidated properly in load balancing environments.
Distribute caches include static (in-memory) cache, runtime cache, front-end content cache and Examine/Lucene indexes. indexes
Constructors
View SourceDistributedCache(IServerMessenger, CacheRefresherCollection)
Initializes a new instance of the DistributedCache class.
Declaration
public DistributedCache(IServerMessenger serverMessenger, CacheRefresherCollection cacheRefreshers)Parameters
| Type | Name | Description | 
|---|---|---|
| IServerMessenger | serverMessenger | The server messenger. | 
| CacheRefresherCollection | cacheRefreshers | The cache refreshers. | 
Methods
View SourceRefresh(Guid, Guid)
Notifies the distributed cache of a specified item invalidation, for a specified ICacheRefresher.
Declaration
public void Refresh(Guid refresherGuid, Guid id)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| Guid | id | The unique identifier of the invalidated item. | 
Refresh(Guid, Int32)
Notifies the distributed cache of a specified item invalidation, for a specified ICacheRefresher.
Declaration
public void Refresh(Guid refresherGuid, int id)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| System.Int32 | id | The unique identifier of the invalidated item. | 
Refresh(Guid, Int32[])
Notifies the distributed cache of a specified item invalidation, for a specified ICacheRefresher.
Declaration
public void Refresh(Guid refresherGuid, params int[] ids)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| System.Int32[] | ids | The unique identifier of the invalidated items. | 
Refresh<T>(Guid, Func<T, Int32>, T[])
Notifies the distributed cache of specified item invalidation, for a specified ICacheRefresher<T>.
Declaration
public void Refresh<T>(Guid refresherGuid, Func<T, int> getNumericId, params T[] instances)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| Func<T, System.Int32> | getNumericId | A function returning the unique identifier of items. | 
| T[] | instances | The invalidated items. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type of the invalidated items. | 
Remarks
This method is much better for performance because it does not need to re-lookup object instances.
RefreshAll(Guid)
Notifies the distributed cache of a global invalidation for a specified ICacheRefresher.
Declaration
public void RefreshAll(Guid refresherGuid)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
RefreshByPayload<TPayload>(Guid, TPayload[])
Refreshes the distributed cache by payload.
Declaration
public void RefreshByPayload<TPayload>(Guid refresherGuid, TPayload[] payload)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| TPayload[] | payload | The payload. | 
Type Parameters
| Name | Description | 
|---|---|
| TPayload | The type of the payload. | 
RefreshByPayload<TPayload>(Guid, IEnumerable<TPayload>)
Refreshes the distributed cache by payload.
Declaration
public void RefreshByPayload<TPayload>(Guid refresherGuid, IEnumerable<TPayload> payloads)
    where TPayload : classParameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| IEnumerable<TPayload> | payloads | The payloads. | 
Type Parameters
| Name | Description | 
|---|---|
| TPayload | The type of the payload. | 
Remove(Guid, Int32)
Notifies the distributed cache of a specified item removal, for a specified ICacheRefresher.
Declaration
public void Remove(Guid refresherGuid, int id)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| System.Int32 | id | The unique identifier of the removed item. | 
Remove(Guid, Int32[])
Notifies the distributed cache of a specified item removal, for a specified ICacheRefresher.
Declaration
public void Remove(Guid refresherGuid, params int[] ids)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| System.Int32[] | ids | The unique identifier of the removed items. | 
Remove<T>(Guid, Func<T, Int32>, T[])
Notifies the distributed cache of specified item removal, for a specified ICacheRefresher<T>.
Declaration
public void Remove<T>(Guid refresherGuid, Func<T, int> getNumericId, params T[] instances)Parameters
| Type | Name | Description | 
|---|---|---|
| Guid | refresherGuid | The unique identifier of the cache refresher. | 
| Func<T, System.Int32> | getNumericId | A function returning the unique identifier of items. | 
| T[] | instances | The removed items. | 
Type Parameters
| Name | Description | 
|---|---|
| T | The type of the removed items. | 
Remarks
This method is much better for performance because it does not need to re-lookup object instances.