Interface ICache<K, T>
Cache.
public interface ICache<K, T> where K : notnull where T : class
Type Parameters
KT
- 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
keyK
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
keyKgetValueFunc<T>
Property Value
- T
The value for the
keyin the cache or the value returned fromgetValue.
Methods
Evict(K)
Evict entry with key.
T? Evict(K key)
Parameters
keyK
Returns
- T
Evicted entry or null if no value cached for
key.