Table of Contents

Class LRUCache<TKey, TValue>

Namespace
Apache.NMS.ActiveMQ.Util
Assembly
Apache.NMS.ActiveMQ.dll
public class LRUCache<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Type Parameters

TKey
TValue
Inheritance
LRUCache<TKey, TValue>
Implements
IEnumerable<KeyValuePair<TKey, TValue>>
Inherited Members

Constructors

LRUCache()

public LRUCache()

LRUCache(int)

public LRUCache(int maxCacheSize)

Parameters

maxCacheSize int

Fields

DEFAULT_MAX_CACHE_SIZE

public const int DEFAULT_MAX_CACHE_SIZE = 10000

Field Value

int

Properties

Count

public int Count { get; }

Property Value

int

this[TKey]

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

Parameters

key TKey

Property Value

TValue

Keys

public ICollection<TKey> Keys { get; }

Property Value

ICollection<TKey>

MaxCacheSize

public int MaxCacheSize { get; set; }

Property Value

int

Values

public ICollection<TValue> Values { get; }

Property Value

ICollection<TValue>

Methods

Add(TKey, TValue)

public void Add(TKey key, TValue val)

Parameters

key TKey
val TValue

Clear()

public void Clear()

ContainsKey(TKey)

public bool ContainsKey(TKey key)

Parameters

key TKey

Returns

bool

ContainsValue(TValue)

public bool ContainsValue(TValue theValue)

Parameters

theValue TValue

Returns

bool

GetEnumerator()

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

Returns

IEnumerator<KeyValuePair<TKey, TValue>>

PutAll(LRUCache<TKey, TValue>)

public void PutAll(LRUCache<TKey, TValue> source)

Parameters

source LRUCache<TKey, TValue>

Remove(TKey)

public bool Remove(TKey v)

Parameters

v TKey

Returns

bool

RemoveEldestEntry(KeyValuePair<TKey, TValue>)

protected virtual bool RemoveEldestEntry(KeyValuePair<TKey, TValue> eldest)

Parameters

eldest KeyValuePair<TKey, TValue>

Returns

bool

TryGetValue(TKey, out TValue)

public bool TryGetValue(TKey key, out TValue val)

Parameters

key TKey
val TValue

Returns

bool