ExpiringCache.getOrCreateRaw

Gets an item from the cache or creates it if not already existing. If the item was found in the cache, its access time is updated, otherwise its create time is set. If the item was found but was expired, the effect is the same as if the item was not found.

Note that the create time is set only if an item is created, not if it already existed and you change the value referenced by the returned reference.

class ExpiringCache(size_t ValueSize = 0)
override
ValueRef
getOrCreateRaw
(
hash_t key
,
out bool existed
)

Parameters

key hash_t

key to lookup

existed bool

true: the item already existed, false: the item was created either because it did not exist or was expired

Return Value

Type: ValueRef

a reference to the value of the obtained or created item. If an old item was replaced, this reference refers to the old value.

Out: See super class.

Meta