Header menu logo TDesu.FSharp

BoundedDict<'TKey, 'TValue> Type

Bounded dictionary — auto-evicts the first-inserted key when capacity is reached. Not thread-safe.

Constructors

Constructor Description

BoundedDict(capacity)

Full Usage: BoundedDict(capacity)

Parameters:
    capacity : int

Returns: BoundedDict<'TKey, 'TValue>
capacity : int
Returns: BoundedDict<'TKey, 'TValue>

Instance members

Instance member Description

this.Clear

Full Usage: this.Clear

Clears all items.

this.ContainsKey

Full Usage: this.ContainsKey

Parameters:
    key : 'TKey

Returns: bool

Returns true if the key exists. The key to check for.

key : 'TKey
Returns: bool

this.Count

Full Usage: this.Count

Returns: int

Number of items.

Returns: int

this[key]

Full Usage: this[key]

Parameters:
    key : 'TKey

Returns: 'TValue

Gets a value by key, throws if not found. The key to retrieve.

key : 'TKey
Returns: 'TValue

this.Remove

Full Usage: this.Remove

Parameters:
    key : 'TKey

Returns: bool

Removes a key. Returns true if removed. The key to remove.

key : 'TKey
Returns: bool

this.Set

Full Usage: this.Set

Parameters:
    key : 'TKey
    value : 'TValue

Adds or updates a key. Evicts the oldest if at capacity. The key to add or update. The value to associate with the key.

key : 'TKey
value : 'TValue

this.TryGet

Full Usage: this.TryGet

Parameters:
    key : 'TKey

Returns: 'TValue option

Tries to get a value by key. The key to look up.

key : 'TKey
Returns: 'TValue option

Type something to start searching.