ExpiringLRUCache.getAndRefresh

Gets an item from the cache. If the item was found in the cache, its access time is updated. If the item life time has expired, it is automatically removed.

Note that, if you change the value referenced by the returned reference, the create time will not be updated.

  1. T* getAndRefresh(hash_t key)
  2. alias getAndRefresh = LRUCache!(T, true).getAndRefresh
  3. T* getAndRefresh(hash_t key, bool expired)
    class ExpiringLRUCache(T = void[])
    T*
    getAndRefresh
    (
    hash_t key
    ,
    out bool expired
    )
    out (val) { if (expired) assert (val is null); }

Parameters

key hash_t

key to lookup

expired bool

true: the item was found but expired so it was removed, false: the item was not found

Return Value

Type: T*

a reference to the item value or null if no such item was found or it has expired so it was removed.

Out: - If expired, the returned reference is null.

Meta