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 DistributedCache
Remarks
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, Examine/Lucene indexes
Constructors
View SourceDistributedCache(IServerMessenger, CacheRefresherCollection)
Declaration
public DistributedCache(IServerMessenger serverMessenger, CacheRefresherCollection cacheRefreshers)
Parameters
Type | Name | Description |
---|---|---|
IServerMessenger | serverMessenger | |
CacheRefresherCollection | cacheRefreshers |
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 ICacheRefresher. |
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 ICacheRefresher. |
System.Int32 | id | The unique identifier of the invalidated item. |
Refresh<T>(Guid, Func<T, Int32>, T[])
Notifies the distributed cache of specified item invalidation, for a specified ICacheRefresher.
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 ICacheRefresher. |
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 ICacheRefresher. |
RefreshByPayload<TPayload>(Guid, TPayload[])
Declaration
public void RefreshByPayload<TPayload>(Guid refresherGuid, TPayload[] payload)
Parameters
Type | Name | Description |
---|---|---|
Guid | refresherGuid | |
TPayload[] | payload |
Type Parameters
Name | Description |
---|---|
TPayload |
RefreshByPayload<TPayload>(Guid, IEnumerable<TPayload>)
Declaration
public void RefreshByPayload<TPayload>(Guid refresherGuid, IEnumerable<TPayload> payloads)
where TPayload : class
Parameters
Type | Name | Description |
---|---|---|
Guid | refresherGuid | |
IEnumerable<TPayload> | payloads |
Type Parameters
Name | Description |
---|---|
TPayload |
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 ICacheRefresher. |
System.Int32 | id | The unique identifier of the removed item. |
Remove<T>(Guid, Func<T, Int32>, T[])
Notifies the distributed cache of specified item removal, for a specified ICacheRefresher.
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 ICacheRefresher. |
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.