Package org.cache2k.io
Interface AsyncCacheLoader.Context<K,V>
-
- All Superinterfaces:
DataAware<K,V>
- Enclosing interface:
- AsyncCacheLoader<K,V>
public static interface AsyncCacheLoader.Context<K,V> extends DataAware<K,V>
Relevant context information for a single load request.Rationale: Instead of a rather long parameter list, we define an interface. This allows us later to add some information without breaking implementations of the
AsyncCacheLoader
. The context does not include the cache, since the loader should not depend on it and do any other operations on the cache while loading.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Cache<K,V>
getCache()
The cache originating the load requestCacheEntry<K,V>
getCurrentEntry()
Current entry in the cache.Executor
getExecutor()
The configured executor for async operations.K
getKey()
Cache key for the load request.Executor
getLoaderExecutor()
The configured loader executor.long
getStartTime()
Time in millis since epoch of start of load operation
-
-
-
Method Detail
-
getStartTime
long getStartTime()
Time in millis since epoch of start of load operation
-
getKey
K getKey()
Cache key for the load request. Although the key is a call parameter it is repeated here, so users can choose to pass on the key or the whole context.
-
getExecutor
Executor getExecutor()
The configured executor for async operations.- See Also:
Cache2kBuilder.executor(Executor)
-
getLoaderExecutor
Executor getLoaderExecutor()
The configured loader executor.- See Also:
Cache2kBuilder.loaderExecutor(Executor)
-
getCurrentEntry
CacheEntry<K,V> getCurrentEntry()
Current entry in the cache. The entry is available if the load is caused by a reload or refresh. If expired before,null
is returned. IfCache2kBuilder.keepDataAfterExpired(boolean)
is enabled, also an expired entry is provided to the loader for optimization purposes. See also the description ofCache2kBuilder.keepDataAfterExpired(boolean)
andCache2kBuilder.refreshAhead(boolean)
.
-
-