#include <asyncresourcecache.h>
Cache class to allow delayed load of data with notification when it's ready to display. Multiple requests are combined (the first request loads the data and notifies all others)
Public Types | |
using | UpdateCacheDelegate = Delegate< Result< void >(const Generic &key, const Generic &loaded)> |
Public Member Functions | |
template<typename KEYTYPE , typename TYPE > | |
MAXON_FUNCTION Result< Opt< TYPE > > | GetData (Delegate< Result< void >(const KEYTYPE &key, const TYPE &loaded)> &&updateDelegate, Bool async=true) const |
MAXON_METHOD Result< Opt< DataRef > > | GetDataImpl (UpdateCacheDelegate &&updateDelegate, Bool async=true) const |
MAXON_METHOD Opt< UniversalDateTime > | GetCacheCreationTime () const |
MAXON_OBSERVABLE (void, ObservableFreeCache,(const KeyData &key), ObservableCombinerRunAllComponent) | |
Private Member Functions | |
MAXON_INTERFACE (AsyncResourceCacheEntryInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.asyncresourcecacheentry") | |
MAXON_GENERIC (typename KEYTYPE=KeyData) | |
MAXON_GENERIC ((Out) typename TYPE=DataRef) | |
using UpdateCacheDelegate = Delegate<Result<void>(const Generic& key, const Generic& loaded)> |
|
private |
|
private |
MAXON_FUNCTION Result<Opt<TYPE> > GetData | ( | Delegate< Result< void >(const KEYTYPE &key, const TYPE &loaded)> && | updateDelegate, |
Bool | async = true |
||
) | const |
GetData returns the data from the cache, if there is one. If nullptr then the data is still loading. In that case the delegate is triggered once the data is loaded.
[in] | updateDelegate | Delegate which is called once the data is loaded. |
[in] | async | Use false to force synchronous loading, by default loading is asynchronous. |
MAXON_METHOD Result<Opt<DataRef> > GetDataImpl | ( | UpdateCacheDelegate && | updateDelegate, |
Bool | async = true |
||
) | const |
MAXON_METHOD Opt<UniversalDateTime> GetCacheCreationTime | ( | ) | const |
MAXON_OBSERVABLE | ( | void | , |
ObservableFreeCache | , | ||
(const KeyData &key) | , | ||
ObservableCombinerRunAllComponent | |||
) |