ExpiringLRUCache.getRefreshOrCreate

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.

  1. T* getRefreshOrCreate(hash_t key, bool existed)
    class ExpiringLRUCache(T = void[])
    override
    T*
    getRefreshOrCreate
    (
    hash_t key
    ,
    out bool existed
    )
  2. alias getRefreshOrCreate = LRUCache!(T, true).getRefreshOrCreate

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: T*

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