Class LRUHashMap<TKey, TValue>
LRUHashMap<TKey, TValue> is similar to of Java's HashMap, which has a bounded Limit; When it reaches that Limit, each time a new element is added, the least recently used (LRU) entry is removed.
Unlike the Java Lucene implementation, this one is thread safe because it is backed by the LurchTable<TKey, TValue>. Do note that every time an element is read from LRUHashMap<TKey, TValue>, a write operation also takes place to update the element's last access time. This is because the LRU order needs to be remembered to determine which element to evict when the Limit is exceeded.
@lucene.experimental
Inheritance
Assembly: DistributedLucene.Net.Facet.dll
Syntax
public class LRUHashMap<TKey, TValue> : IDictionary<TKey, TValue>
Type Parameters
Name | Description |
---|---|
TKey | |
TValue |
Constructors
Name | Description |
---|---|
LRUHashMap(Int32) | Create a new hash map with a bounded size and with least recently used entries removed. |
Properties
Name | Description |
---|---|
Count | |
IsReadOnly | |
Item[TKey] | |
Keys | |
Limit | allows changing the map's maximal number of elements which was defined at construction time. Note that if the map is already larger than Limit, the current implementation does not shrink it (by removing the oldest elements); Rather, the map remains in its current size as new elements are added, and will only start shrinking (until settling again on the given Limit) if existing elements are explicitly deleted. |
Values |