Interface ICache<K, T>
Cache.
public interface ICache<K, T> where K : notnull where T : class
Type Parameters
K
T
- Extension Methods
Properties
Entries
Cached entries.
IEnumerable<KeyValuePair<K, T>> Entries { get; }
Property Value
- IEnumerable<KeyValuePair<K, T>>
Snapshot of the currently cached entries.
this[K]
Get or set value with key
.
T? this[K key] { get; set; }
Parameters
key
K
Property Value
- T
Cached entry or null if no value cached for
key
.
this[K, Func<T>]
Gets an already cached value for the given key
or if no cached value exists adds the value returned from getValue
.
T? this[K key, Func<T> getValue] { get; }
Parameters
key
KgetValue
Func<T>
Property Value
- T
The value for the
key
in the cache or the value returned fromgetValue
.
Methods
Evict(K)
Evict entry with key
.
T? Evict(K key)
Parameters
key
K
Returns
- T
Evicted entry or null if no value cached for
key
.