PostSharpAPI ReferencePost­Sharp.​Patterns.​Caching.​ImplementationCaching­Backend
Open sandboxFocus

CachingBackend Class

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

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

Constructors

Name Description
CachingBackend()

Initializes a new CachingBackend.

Properties

Name Description
Id

Gets the System.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 System.IO.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(Boolean)

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

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, Boolean)

Gets a cache item given its key.

GetItemAsync(String, Boolean, CancellationToken)

Asynchronously gets a cache item given its key.

GetItemAsyncCore(String, Boolean, 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, Boolean)

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.