Cache.getOrCreate

Gets an item from the cache or creates it if not already existing. If the item exists in the cache, its update time is updated, otherwise its create time is set.

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

class Cache(T, bool TrackCreateTimes = false)
T*
getOrCreate
(
hash_t key
,
out bool existed
)
out (val) { assert (val !is null); }

Parameters

key hash_t

key to lookup

existed bool

true: the item already existed, false: the item was created

Return Value

Type: T*

pointer to item value

Meta