CacheMap.CacheMap

A caching map which when queried for a key which does not exist yet will call a so-called replacement function which produces a result which will be stored at that key's location

After this process a timer is started, and periodically entries are checked for timeouts, if they have timed out then they are removed and the process begins again.

Accessing an entry will reset its timer ONLY if it has not yet expired however accessing an entry which has expired causing an on-demand replacement function call, just not a removal in between

Constructors

this
this(ReplacementDelegate replFunc, Duration expirationTime, Duration sweepInterval)

Constructs a new cache map with the given replacement delegate and the expiration deadline.

this
this(ReplacementFunction replFunc, Duration expirationTime, Duration sweepInterval)

Constructs a new cache map with the given replacement function and the expiration deadline.

Destructor

~this
~this()

On destruction, set the running status to false, then wake up the checker and wait for it to exit

Members

Functions

get
V get(K key)

Gets the value of the entry at the provided key

opIndex
V opIndex(K key)
removeKey
bool removeKey(K key)

Removes the given key returning whether or not it was a success

Meta