Class Cache<T>
Cache implementation for types that do not need to be deconstructed.
Inheritance
System.Object
Cache<T>
Implements
ICache<T>
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public class Cache<T> : Object, ICache<T>
Type Parameters
Name | Description |
---|---|
T | Type of the objects kept in the cache. |
Constructors
Cache()
Instantiates the cache with a default cache storage.
Declaration
public Cache()
Cache(ICacheStorage<T>)
Instantiates the cache with the provided cache storage.
Declaration
public Cache(ICacheStorage<T> storage)
Parameters
Type | Name | Description |
---|---|---|
ICacheStorage<T> | storage | The cache storage. |
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 virtual 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. |