Open sandboxFocus

Class CacheSynchronizer

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
CacheSynchronizer
Namespace: Metalama.Patterns.Caching.Implementation
Assembly: Metalama.Patterns.Caching.Backend.dll
Syntax
public abstract class CacheSynchronizer : CachingBackendEnhancer, IDisposable, IAsyncDisposable

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)

Asynchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

DisposeCore(bool, CancellationToken)

Synchronously disposes the current CachingBackend. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

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)

Returns a Task that is signaled to the complete state when all background tasks have completed.

Extension Methods