The parent this cache is derived from.
The parent this cache is derived from.
This methods defines the process of transforming a key value pair from the parent cache into a iterable collection of key value pairs for the derived cache.
This methods defines the process of transforming a key value pair from the parent cache into a iterable collection of key value pairs for the derived cache.
- key of the parent cache
- value of the parent cache
- an iterable collection of derived key,value pairs
Try to load a value from the cache with the given key.
Try to load a value from the cache with the given key.
This will try to fetch the value from the in-memory cache with no remote call on cache-misses.
unique key of the needed value.
an optional value if found, None otherwise.
Test if the cache has been started.
Test if the cache has been started.
Notifies all registered SyncCacheEventHandler
's that
cache
was reloaded.
Notifies all registered SyncCacheEventHandler
's that
cache
was reloaded.
- cache that was reloaded
Reloads the content of this cache from the provided fromCache
and notifies all registered SyncCacheEventHandler
s for cache reload.
Reloads the content of this cache from the provided fromCache
and notifies all registered SyncCacheEventHandler
s for cache reload.
- the content of the parent cache that was reloaded
Loads the content of this cache from its parent, if the parent is started.
Loads the content of this cache from its parent, if the parent is started. Register itself for parent cache change notifications.
This method should be called only once, when the cache is ready to receive notifications. Subsequent calls to this method are of no effect.
this cache ready to receive notifications from its parent
Register a SyncCacheEventHandler
to be notified for cache events.
Register a SyncCacheEventHandler
to be notified for cache events.
- the handler to be notified for cache events
Stop the cache from loading.
Stop the cache from loading.
Starts the loading of the cache.
Starts the loading of the cache.
This trait provides a sync cache implementation with ability to register
SyncCacheEventHandler
s which will be notified when the cache content is reloaded. Content of this cache is loaded from a parentSyncCache
and it is reloaded on parent cache reload.- key type of the parent cache
- value type of the parent cache
- key type of this cache
- value type of this cache