Class DistributedCache
Represents the entry point into Umbraco's distributed cache infrastructure.
Inheritance
Namespace: Umbraco.Web.Cache
Assembly: Umbraco.Web.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
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 |
---|---|---|
System.Guid | refresherGuid | The unique identifier of the ICacheRefresher. |
System.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 |
---|---|---|
System.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 |
---|---|---|
System.Guid | refresherGuid | The unique identifier of the ICacheRefresher. |
System.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 |
---|---|---|
System.Guid | refresherGuid | The unique identifier of the ICacheRefresher. |
RefreshByJson(Guid, String)
Notifies the distributed cache, for a specified ICacheRefresher.
Declaration
public void RefreshByJson(Guid refresherGuid, string jsonPayload)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | refresherGuid | The unique identifier of the ICacheRefresher. |
System.String | jsonPayload | The notification content. |
RefreshByPayload<TPayload>(Guid, TPayload[])
Declaration
public void RefreshByPayload<TPayload>(Guid refresherGuid, TPayload[] payload)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|---|
System.Guid | refresherGuid | |
System.Collections.Generic.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 |
---|---|---|
System.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 |
---|---|---|
System.Guid | refresherGuid | The unique identifier of the ICacheRefresher. |
System.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.