Show / Hide Table of Contents

Class LRUCache<TKey, TValue>

Generic LRU cache implementation.

Inheritance
System.Object
LRUCache<TKey, TValue>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class LRUCache<TKey, TValue>
Type Parameters
TKey

The key type.

TValue

The value type.

Constructors

LRUCache(Int32)

Initializes this cache.

Declaration
public LRUCache(int capacity)
Parameters
System.Int32 capacity

Fields

OnRemove

Called when an item is pushed out of the cache.

Declaration
public LRUCache<TKey, TValue>.OnRemoveDelegate OnRemove
Field Value
LRUCache.OnRemoveDelegate<>

Properties

Capacity

Capacity.

Declaration
public int Capacity { get; set; }
Property Value
System.Int32

Count

Returns the amount of entries in this cache.

Declaration
public int Count { get; }
Property Value
System.Int32

Methods

Add(TKey, TValue)

Adds a new value for the given key.

Declaration
public void Add(TKey key, TValue value)
Parameters
TKey key

TValue value

Clear()

Clears this cache.

Declaration
public void Clear()

Remove(TKey)

Removes the value for the given key.

Declaration
public void Remove(TKey id)
Parameters
TKey id

TryGet(TKey, out TValue)

Returns the value for this given key.

Declaration
public bool TryGet(TKey key, out TValue value)
Parameters
TKey key

TValue value

Returns
System.Boolean

TryPeek(TKey, out TValue)

Returns the value for this given key but does not effect the cache.

Declaration
public bool TryPeek(TKey key, out TValue value)
Parameters
TKey key

TValue value

Returns
System.Boolean

Back to top Built by Itinero, MIT licensed.