Interface ICacheSyncService
Provides cache synchronization capabilities for load-balanced Umbraco environments.
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public interface ICacheSyncService
Remarks
This service synchronizes isolated caches across servers in a load-balanced cluster by rolling forward out-of-date caches. It separates synchronization into two distinct operations: internal isolated caches (repositories and services) and published content caches, enabling selective cache refreshing.
Methods
View SourceSyncAll(CancellationToken)
Synchronizes all caches including both isolated caches and published content caches.
Declaration
void SyncAll(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Remarks
This method clears all isolated caches (repositories and services) and published content caches (IPublishedContentCache, route caching, etc.) to ensure complete cache consistency across the cluster.
SyncInternal(CancellationToken)
Synchronizes only isolated caches without affecting the published content cache layer.
Declaration
void SyncInternal(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Remarks
This method clears only the isolated caches used by repositories and services, leaving the published content cache layer to SyncAll(CancellationToken). Payload instructions run only RefreshInternal(string), and id-based instructions run their in-memory refresh. The synchronization itself takes no in-process or distributed locks and writes nothing to the database, so it is safe to call while holding distributed locks as long as every refresher honours the same contract on RefreshInternal(string); the caller's next repository read reloads the cleared entries from the database.