![]() | ScaleOut Software Collections for .NET |
This library provides generic dictionaries designed to simplify the creation of an in-process cache.
The library provides the following two, primary classes:
RecentDictionaryTKey, TValue: A collection of keys and values that tracks the order in which entries are accessed, suitable for creating a cache with an LRU or MRU eviction policy.
RouletteDictionaryTKey, TValue: A collection of keys and values that allows random entries to be retrieved or removed, suitable for creating a cache with a random eviction policy.
Both classes implement a SetAndMaintainCount method that can be used to set values while keeping the dictionary at a fixed size. If the operation results in a value being added, another entry will be removed to make room: The RecentDictionary will evict either the most-recently or least-recently used entry (depending on the eviction mode passed into the constructor), and RouletteDictionary will evict a random entry.