Open sandboxFocus

Class CachingBackend

An abstraction of the physical implementation of the cache, where the CacheAttribute ends up writing to and reading from.

Implements
Namespace: PostSharp.Patterns.Caching.Implementation
Assembly: PostSharp.Patterns.Caching.dll
Syntax
public abstract class CachingBackend : IDisposable

Constructors

Name Description
CachingBackend()

Initializes a new CachingBackend.

Properties

Name Description
Id

Gets the Guid of the current CachingBackend.

Logger

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

Status

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

SupportedFeatures

Gets the set of features supported by the current CachingBackend.

ValueAdapters

Gets the factory of value adapters (IValueAdapter), which allow for instance to cache things like Stream or IEnumerable, which could not be otherwise cached.

Methods

Name Description
Clear()

Clears the cache.

ClearAsync(CancellationToken)

Asynchronously clears the cache.

ClearAsyncCore(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()

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.

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.

Dispose(bool)

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.

DisposeAsync(CancellationToken)

Asynchronously dispose the current CachingBackend.

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)

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.

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. 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.

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.