Cache.createRaw

Creates an item in the cache and sets its create time. If the cache is full, the oldest item is replaced with the new item. (In the case where several items are equally old, the choice of which one to be replaced is made arbitrarily.)

class Cache(size_t ValueSize = 0, bool TrackCreateTimes = false)
ValueRef
createRaw
(
hash_t key
)
out (val) { static if (is_dynamic) { assert (val !is null); } else { assert (val.length == ValueSize); } }

Parameters

key hash_t

item key

Return Value

Type: ValueRef

a reference to the value of the created item. If an existing item was replaced, this reference refers to its current value, otherwise it may refer to the value of a previously removed element.

Out: The returned reference is never null; for values of fixed size the slice length is ValueSize.

Meta