Header menu logo B2R2

LRUCache<'K, 'V> Type

Represents a Least Recently Used (LRU) cache that does not support concurrency. The capacity must be positive.

Constructors

Constructor Description

LRUCache(capacity)

Full Usage: LRUCache(capacity)

Parameters:
    capacity : int

Returns: LRUCache<'K, 'V>
capacity : int
Returns: LRUCache<'K, 'V>

Instance members

Instance member Description

this.Add

Full Usage: this.Add

Parameters:
    key : 'K
    value : 'V

Adds or replaces a value in the cache. Replacing an existing key removes the old entry and inserts the new value as the most recently used entry.

key : 'K
value : 'V

this.Clear

Full Usage: this.Clear

Removes all entries from the cache.

this.Count

Full Usage: this.Count

Returns: int

Gets the number of entries currently stored in the cache.

Returns: int

this.TryGet

Full Usage: this.TryGet

Parameters:
    key : 'K
    refCount : byref<int>

Returns: Result<'V, ErrorCase>

Tries to retrieve the value and reference count for the given key. When the key exists, the entry is promoted to the most recently used position.

key : 'K
refCount : byref<int>
Returns: Result<'V, ErrorCase>

this.TryGet

Full Usage: this.TryGet

Parameters:
    key : 'K

Returns: Result<'V, ErrorCase>

Tries to retrieve the value for the given key. When the key exists, the entry is promoted to the most recently used position.

key : 'K
Returns: Result<'V, ErrorCase>

Type something to start searching.