Class CacheStorage<T>
Basic cache storage implementation.
Inheritance
System.Object
CacheStorage<T>
Implements
Namespace: System.Memory
Assembly: Nuqleon.Memory.dll
Syntax
public sealed class CacheStorage<T> : Object, ICacheStorage<T>
Type Parameters
Name | Description |
---|---|
T | Type of the objects kept in the cache. |
Constructors
CacheStorage()
Initializes the cache storage with a default equality comparer.
Declaration
public CacheStorage()
CacheStorage(IEqualityComparer<T>)
Initializes the cache storage with the provided equality comparer.
Declaration
public CacheStorage(IEqualityComparer<T> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEqualityComparer<T> | comparer | The equality comparer used to compare cached objects. |
Properties
Count
Gets the current number of entries stored in the cache.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
GetEntry(T)
Gets the cache entry for the provided value.
Declaration
public IReference<T> GetEntry(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value. |
Returns
Type | Description |
---|---|
IReference<T> | The cache entry. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the provided value is null. |
ReleaseEntry(IReference<T>)
Releases a cache entry.
Declaration
public void ReleaseEntry(IReference<T> entry)
Parameters
Type | Name | Description |
---|---|---|
IReference<T> | entry | The entry to release. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the provided entry is null. |
System.ArgumentException | Thrown if the value contained in the entry is null. |