RingDictionaryBuffer Class
This class will maintain a cache of entries and the oldest ones will expire when it runs out of space. Each time an item is added to a key, that key's freshness is refreshed. Each key is associated with a list of entries.
ICollection< TValue > this[TKey key][Get]
RingDictionaryBuffer ( int capacity )
bool Add ( TKey key,
TValue value,
bool unique )
Adds an entry to the key. This also updates the "freshness" of the entry.
ParametersuniqueWill only add the value if it does not already exist.
ReturnsTrue if the key value was added. False otherwise.
bool ContainsKey ( TKey key )
Returns true if the key exists in the buffer.
ReturnsTrue if the key exists in the buffer. False otherwise.
IEnumerable< TValue > Extract ( TKey key )
Drain all the entries from the buffer that match a given key and return them.
ParameterskeyThe key we are extracting.
ReturnsAll the entries in the buffer for that specific key.
IEnumerable< TValue > ExtractAll ( )
Drain all the entries from the buffer and return them.
ReturnsAll the entries in the buffer ordered by the key (e.g. correlation IDs).