<PackageReference Include="Relativity.Server.Utility.SDK" Version="5000.0.0" />

LazyDictionaryCache<TKey, TValue>

public class LazyDictionaryCache<TKey, TValue> : IDictionary<TKey, TValue>, IDisposable
An IDictionary<T, U> implementation backed by a TypedLazyMemoryCache<T, U>.
public int Count { get; }

Returns the count of items currently stored in the dictionary.

public bool IsReadOnly { get; }

Returns whether modification of the dictionary is restricted.

public TValue this[TKey key] { get; set; }

Gets or sets a value associated with the key. If an entry doesn't already exist for the key, an entry will be created with a new value.

public ICollection<TKey> Keys { get; }

Returns the keys of the entries currently stored in the dictionary.

public ICollection<TValue> Values { get; }

Returns the values of the entries currently stored in the dictionary.

public LazyDictionaryCache(CachingOptions options, Func<TKey, string> keyFormatter, Func<TKey, CancellationToken, TValue> valueFactory)

Creates an IDictionary<T, U> implementation backed by a TypedLazyMemoryCache<T, U>.

public void Add(TKey key, TValue value)

Adds an entry to the dictionary.

public void Clear()

Removes all entries in the dictionary.

public bool ContainsKey(TKey key)

Returns whether the cache currently contains an entry with the given key.

protected virtual void Dispose(bool disposing)

public void Dispose()

public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()

Creates an enumerator over the Key Value pairs stored in the cache.

public bool Remove(TKey key)

Removes an entry from the dictionary with a given key.

public bool TryGetValue(TKey key, ref TValue value)

Attempts to retrieve a value from the cache for a given key. If the value doesn't exist, it will not be created.