MetalamaAPI documentationPatterns APIMetalama.​Patterns.​Caching.​ImplementationCache­Synchronizer
Open sandboxFocus

CacheSynchronizer Class

Base class for a kind of CachingBackendEnhancer that allows several instances of the same application to use a local cache, and synchronize themselves by sending invalidation messages over a publish/subscribe channel.

Inheritance
System.Object
CacheSynchronizer
Implements
System.IDisposable
System.IAsyncDisposable
Namespace: Metalama.Patterns.Caching.Implementation
Assembly: Metalama.Patterns.Caching.Backend.dll
Syntax
public abstract class CacheSynchronizer : CachingBackendEnhancer

Constructors

Name Description
CacheSynchronizer(CachingBackend, CacheSynchronizerConfiguration)

Initializes a new instance of the CacheSynchronizer class.

Properties

Name Description
Configuration

Gets the options of the current CacheSynchronizer.

Methods

Name Description
DisposeAsyncCore(CancellationToken)
DisposeCore(Boolean, CancellationToken)
InvalidateDependencyAsyncCore(String, CancellationToken)

Asynchronously removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

InvalidateDependencyCore(String)

Removes from the cache all items that have a specific dependency. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

OnMessageReceived(String)

Implementations of CacheSynchronizer must call this method when an invalidation message is received.

RemoveItemAsyncCore(String, CancellationToken)

Asynchronously removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

RemoveItemCore(String)

Removes a cache item from the cache given its key. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked. Arguments are already validated by the consumer API.

SendMessageAsync(String, CancellationToken)

Sends an invalidation message over the message bus of the implementation.

WhenBackgroundTasksCompleted(CancellationToken)