Header menu logo B2R2

ConcurrentLRUCache<'K, 'V> Type

Represents Least Recently Used (LRU) cache supporting concurrency. The capacity must be positive and decides how many entries to store.

Constructors

Constructor Description

ConcurrentLRUCache(capacity)

Full Usage: ConcurrentLRUCache(capacity)

Parameters:
    capacity : int

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

Instance members

Instance member Description

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.GetOrAdd

Full Usage: this.GetOrAdd

Parameters:
Returns: 'V

Gets the value for the given key, or computes and adds it on a cache miss. The cache lock is not held while creates the value, so concurrent misses for the same key may compute the value more than once. Before inserting, this method checks the cache again and returns the already cached value if another thread inserted it first.

key : 'K
factory : ICacheValueFactory<'a, 'V>
arg : 'a
Returns: 'V

Type something to start searching.