Show / Hide Table of Contents

Class Cache<T, TCached1, TCached2, TCached3, TNonCached>

Utility for deconstructing objects into cacheable and non-cacheable components and sharing the parts that are cacheable.

Inheritance
System.Object
Cache<T, TCached1, TCached2, TCached3, TNonCached>
Implements
ICache<T>
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public abstract class Cache<T, TCached1, TCached2, TCached3, TNonCached> : Object, ICache<T>
Type Parameters
Name Description
T

Type of the objects kept in the cache.

TCached1

Type of the first cacheable component of the cached type.

TCached2

Type of the second cacheable component of the cached type.

TCached3

Type of the third cacheable component of the cached type.

TNonCached

Type of the non-cacheable component of the cached type.

Constructors

Cache()

Instantiates the cache with a default cache policies and equality comparers.

Declaration
protected Cache()

Cache(ICache<TCached1>, ICache<TCached2>, ICache<TCached3>)

Instantiates the cache with the caches to use for cached components.

Declaration
protected Cache(ICache<TCached1> innerCache1, ICache<TCached2> innerCache2, ICache<TCached3> innerCache3)
Parameters
Type Name Description
ICache<TCached1> innerCache1

The first inner cache.

ICache<TCached2> innerCache2

The second inner cache.

ICache<TCached3> innerCache3

The third inner cache.

Methods

Create(T)

Deconstructs the instance into cacheable and non-cacheable components, caches the cacheable component, and returns a handle that can be used to reconstruct the original instance.

Declaration
public IDiscardable<T> Create(T value)
Parameters
Type Name Description
T value

The instance to cache.

Returns
Type Description
IDiscardable<T>

A handle to reconstruct the original instance.

Deconstruct(T)

Deconstructs an instance of the cached type into its cacheable and non-cacheable components.

Declaration
protected abstract Deconstructed<TCached1, TCached2, TCached3, TNonCached> Deconstruct(T value)
Parameters
Type Name Description
T value

The instance to cache.

Returns
Type Description
Deconstructed<TCached1, TCached2, TCached3, TNonCached>

The deconstructed instance.

Reconstruct(Deconstructed<TCached1, TCached2, TCached3, TNonCached>)

Reconstructs an instance of the cached type from its cacheable and non-cacheable components.

Declaration
protected abstract T Reconstruct(Deconstructed<TCached1, TCached2, TCached3, TNonCached> deconstructed)
Parameters
Type Name Description
Deconstructed<TCached1, TCached2, TCached3, TNonCached> deconstructed

The deconstructed instance.

Returns
Type Description
T

The reconstructed instance.

Implements

ICache<T>
In This Article
Back to top Generated by DocFX