#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 | LoadCacheDelegate = Delegate< Result< DataRef >(const KeyData &key)> |
Public Member Functions | |
MAXON_ADD_TO_REFERENCE_CLASS (using Entry=AsyncResourceCacheEntryRef< KEYTYPE, TYPE >;) | |
template<typename KEYTYPE > | |
MAXON_FUNCTION Result< void > | InvalidateCache (const KEYTYPE &key) |
MAXON_METHOD Result< void > | InvalidateCacheImpl (const KeyData &key) |
template<typename KEYTYPE , typename TYPE > | |
MAXON_FUNCTION Result< AsyncResourceCacheEntryRef< KEYTYPE, TYPE > > | FindOrCreate (const KEYTYPE &key) |
MAXON_METHOD Result< AsyncResourceCacheEntryRef< KEYTYPE, TYPE > > | FindOrCreateImpl (const KeyData &key) |
MAXON_METHOD void | Reset () |
MAXON_METHOD Result< void > | GetStatistics (Int &cnt, Int &mem) |
Static Public Member Functions | |
template<typename KEYTYPE , typename TYPE > | |
static MAXON_FUNCTION Result< AsyncResourceCacheRef< KEYTYPE, TYPE > > | Create (ASYNCRESOURCECACHEFLAGS flags, Int queueSize, Int cacheLimit, Delegate< Result< TYPE >(const KEYTYPE &key)> &&loadDelegate) |
static MAXON_METHOD Result< AsyncResourceCacheRef<> > | CreateImpl (ASYNCRESOURCECACHEFLAGS flags, Data &&defaultValue, Int queueSize, Int cacheLimit, LoadCacheDelegate &&loadDelegate) |
Private Member Functions | |
MAXON_INTERFACE (AsyncResourceCacheInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.asyncresourcecache") | |
MAXON_GENERIC (typename KEYTYPE=KeyData) | |
MAXON_GENERIC ((Out) typename TYPE=DataRef) | |
using LoadCacheDelegate = Delegate<Result<DataRef>(const KeyData& key)> |
|
private |
|
private |
MAXON_ADD_TO_REFERENCE_CLASS | ( | using | Entry = AsyncResourceCacheEntryRef< KEYTYPE, TYPE >; | ) |
|
static |
|
static |
MAXON_FUNCTION Result<void> InvalidateCache | ( | const KEYTYPE & | key | ) |
InvalidateCache invalidates and removed the data from the cache. The next request will reload the data.
[in] | key | Data to discard from the cache. |
MAXON_METHOD Result<void> InvalidateCacheImpl | ( | const KeyData & | key | ) |
MAXON_FUNCTION Result<AsyncResourceCacheEntryRef<KEYTYPE, TYPE> > FindOrCreate | ( | const KEYTYPE & | key | ) |
FindOrCreate returns the cache for the requested data resource.
[in] | key | Key of the data to load. |
MAXON_METHOD Result<AsyncResourceCacheEntryRef<KEYTYPE, TYPE> > FindOrCreateImpl | ( | const KeyData & | key | ) |
MAXON_METHOD void Reset | ( | ) |
Resets all caches.
MAXON_METHOD Result<void> GetStatistics | ( | Int & | cnt, |
Int & | mem | ||
) |
Returns the current cache usage by type, count etc.
[out] | cnt | the number of entries of the cache, |
[out] | mem | memory usage by this entry. |