CacheCore

Cache values in-memory, and automatically load/save them as needed via the specified functions. Actual loading/saving is done via alias functions. KeyGetter may return .init (of its return type) if the resource does not yet exist, but once it returns non-.init it may not return .init again. A bool key can be used to load a resource from disk only once (lazily), as is currently done with LoadPolicy.once. Delayed flush policies require a bool key, to avoid mid-air collisions.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

_CacheCore_Data
alias _CacheCore_Data = ReturnType!DataGetter
Undocumented in source.
_CacheCore_Key
alias _CacheCore_Key = ReturnType!KeyGetter
Undocumented in source.

Functions

_CacheCore_registerFlush
void _CacheCore_registerFlush()
Undocumented in source. Be warned that the author may not have intended to support it.
_CacheCore_update
void _CacheCore_update()
Undocumented in source. Be warned that the author may not have intended to support it.
save
void save()

Save the data. Obtain a fresh copy of the key afterwards (by reading it again), unless exiting is true.

Manifest constants

_CacheCore_readOnly
enum _CacheCore_readOnly;
Undocumented in source.

Properties

_CacheCore_data
auto _CacheCore_data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
_CacheCore_data
auto ref _CacheCore_data [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_CacheCore_pending
typeof(this)*[] _CacheCore_pending;
Undocumented in source.

Variables

cachedData
_CacheCore_Data cachedData;

The currently loaded version of the data.

cachedDataKey
_CacheCore_Key cachedDataKey;

The key (version) of the last loaded version of the data.

Parameters

DataGetter

Callable which obtains a new copy of the data.

KeyGetter

Callable which (cheaply) obtains the current version of the data.

DataPutter

Callable which saves the data (or None).

flushPolicy

When to save the data.

Meta