Aardvark.Base


LruCache<'TKey, 'TValue>

A least-recently-used cache, with specifyable capacity and per-item size-, read-, and delete function. The indexer is used to access items. Capacity can be changed on the fly. All operations are synchronized for use in multi-threaded applications.

Constructors

ConstructorDescription
new(...)
Signature: (capacity:int64 * sizeFun:Func<'TKey,int64> * readFun:Func<'TKey,'TValue> * deleteAct:Action<'TKey,'TValue>) -> unit

Creates an LruCache with the specified capacity, per-item (Key) size function, per-item (Key) read function, and per-item (key/value) delete action. The indexer is used to access items. Capacity can be changed on the fly. All operations are synchronized for use in multi-threaded applications.

new(capacity)
Signature: capacity:int64 -> unit

Instance members

Instance memberDescription
Capacity()
Signature: unit -> unit
GetOrAdd(key, size, valueFun, deleteAct)
Signature: (key:'TKey * size:int64 * valueFun:Func<'TValue> * deleteAct:Action) -> 'TValue
Remove(key)
Signature: key:'TKey -> bool

Remove the entry with the supplied key from the hash. Returns true on success.

TryRemove(key, value)
Signature: (key:'TKey * value:byref<'TValue>) -> bool

Remove the entry with the supplied key from the hash. Returns true on success and puts the value of the entry into the out parameter.

Fork me on GitHub