LruCache<TKey,TValue> Class

Definition

A simple LRU cache implementation using a doubly linked list and dictionary.

public class LruCache<TKey,TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>
type LruCache<'Key, 'Value> = class
    interface seq<KeyValuePair<'Key, 'Value>>
    interface IEnumerable
Public Class LruCache(Of TKey, TValue)
Implements IEnumerable(Of KeyValuePair(Of TKey, TValue))

Type Parameters

TKey

The type of key.

TValue

The type of value.

Inheritance
LruCache<TKey,TValue>
Implements

Constructors

LruCache<TKey,TValue>(Int32)

Initializes a new instance of the LruCache<TKey,TValue> class.

Properties

Count

Gets the number of key/value pairs contained in the LruCache<TKey,TValue>.

TotalLength

Gets the total length of all values currently stored in the LruCache<TKey,TValue>.

Methods

AddOrUpdate(TKey, TValue, Int32)

Adds a key/value pair to the LruCache<TKey,TValue> if the key doesn't already exist, or updates a key/value pair in the LruCache<TKey,TValue> if the key does already exist.

GetEnumerator()

Returns an enumerator that iterates through the LruCache<TKey,TValue>.

TryGet(TKey, TValue)

Gets the value associated with the specified key.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Applies to