Open sandboxFocus

Class CachingBackend

An abstraction of the physical implementation of the cache.

Inheritance
CachingBackend
Namespace: Metalama.Patterns.Caching.Backends
Assembly: Metalama.Patterns.Caching.Backend.dll
Syntax
public abstract class CachingBackend : IDisposable, IAsyncDisposable

Constructors

Name Description
CachingBackend(CachingBackendConfiguration?, IServiceProvider?)

Initializes a new instance of the CachingBackend class.

Properties

Name Description
BackgroundTaskExceptions
Configuration
DebugName
DisposeCancellationToken

Gets a CancellationToken signalled when the CancellationToken passed to Dispose() or DisposeAsync() is signalled.

Id

Gets the Guid of the current CachingBackend.

LogSource

Gets the FlashtraceSource that implementations can use to emit log records.

ServiceProvider
Status

Gets the status of the current CachingBackend (Default, Disposing or Disposed).

SupportedFeatures

Gets the set of features supported by the current CachingBackend.

Methods

Name Description
Clear(ClearCacheOptions)

Clears the cache.

ClearAsync(ClearCacheOptions, CancellationToken)

Asynchronously clears the cache.

ClearAsyncCore(ClearCacheOptions, CancellationToken)

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

ClearCore(ClearCacheOptions)

Clears the cache. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

ContainsDependency(string)

Determines whether the cache contains a given dependency.

ContainsDependencyAsync(string, CancellationToken)

Asynchronously determines whether the cache contains a given dependency.

ContainsDependencyAsyncCore(string, CancellationToken)

Asynchronously determines whether the cache contains a given 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.

ContainsDependencyCore(string)

Determines whether the cache contains a given 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.

ContainsItem(string)

Determines whether the cache contains an item of a given key.

ContainsItemAsync(string, CancellationToken)

Asynchronously determines whether the cache contains an item of a given key.

ContainsItemAsyncCore(string, CancellationToken)

Asynchronously determines whether the cache contains an item of a given 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.

ContainsItemCore(string)

Determines whether the cache contains an item of a given 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.

Create(Func<CachingBackendBuilder, ConcreteCachingBackendBuilder>, IServiceProvider?)
CreateFeatures()

Creates a CachingBackendFeatures object, which describes set of features implemented by the back-end. This method is invoked the first time the SupportedFeatures property is evaluated. The result is then cached.

Dispose()

Synchronously disposes the current CachingBackend. In case the CachingBackend has pending background tasks (typically cache non-blocking cache update tasks for distributed backends), it will wait until all tasks are processed.

Dispose(bool, CancellationToken)

Synchronously disposes the current CachingBackend, with a parameter instructing whether this method is called because of a call to the Dispose() method or because of object finalizing.

Dispose(CancellationToken)

Synchronously disposes the current CachingBackend. This overloads accepts a CancellationToken. In case the CachingBackend has pending background tasks (typically cache non-blocking cache update tasks for distributed backends), it will wait until all tasks are processed.

DisposeAsync()
DisposeAsync(CancellationToken)

Asynchronously dispose the current CachingBackend. This overload accepts a CancellationToken. In case the CachingBackend has pending background tasks (typically cache non-blocking cache update tasks for distributed backends), it will wait until all tasks are processed.

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.

GetItem(string, bool)

Gets a cache item given its key.

GetItemAsync(string, bool, CancellationToken)

Asynchronously gets a cache item given its key.

GetItemAsyncCore(string, bool, CancellationToken)

Asynchronously gets a cache item 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.

GetItemCore(string, bool)

Gets a cache item 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.

Initialize()
InitializeAsync(CancellationToken)
InitializeCore()
InitializeCoreAsync(CancellationToken)
InvalidateDependencies(IReadOnlyCollection<string>)

Removes from the cache all items that have a specific dependency.

InvalidateDependenciesAsync(IReadOnlyCollection<string>, CancellationToken)

Asynchronously removes from the cache all items that have one of the specified dependencies.

InvalidateDependency(string)

Removes from the cache all items that have a specific dependency.

InvalidateDependencyAsync(string, CancellationToken)

Asynchronously removes from the cache all items that have a specific dependency.

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.

OnDependencyInvalidated(CacheDependencyInvalidatedEventArgs)

Raises the DependencyInvalidated event given a CacheDependencyInvalidatedEventArgs.

OnDependencyInvalidated(string, Guid)

Raises the DependencyInvalidated event , but lazily instantiates the CacheDependencyInvalidatedEventArgs if there is an event client.

OnItemRemoved(CacheItemRemovedEventArgs)

Raises the ItemRemoved event given a CacheItemRemovedEventArgs.

OnItemRemoved(string, CacheItemRemovedReason, Guid)

Raises the ItemRemoved event, but lazily instantiates the CacheItemRemovedEventArgs if there is an event client.

RemoveItem(string)

Removes a cache item from the cache given its key.

RemoveItemAsync(string, CancellationToken)

Asynchronously removes a cache item from the cache given its key.

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.

SetItem(string, CacheItem)

Sets a cache item.

SetItemAsync(string, CacheItem, CancellationToken)

Asynchronously sets a cache item.

SetItemAsyncCore(string, CacheItem, CancellationToken)

Asynchronously sets a cache item. 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. The default implementation is to call the synchronous SetItemCore(string, CacheItem) method.

SetItemCore(string, CacheItem)

Sets a cache item. 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.

ToString()
WhenBackgroundTasksCompleted(CancellationToken)

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

Events

Name Description
DependencyInvalidated

Events raised when a dependency is invalidated. Check the Events property to see if the current CachingBackend supports events.

ItemRemoved

Event raised when a cache item is removed from the cache. Check the Events property to see if the current CachingBackend supports events.

Extension Methods