AsyncLoadingCache.
Most implementations will only need to implement asyncLoad. Other methods may be
overridden as desired.
Usage example:
AsyncCacheLoader<Key, Graph> loader = (key, executor) ->
createExpensiveGraphAsync(key, executor);
AsyncLoadingCache<Key, Graph> cache = Caffeine.newBuilder().buildAsync(loader);
| Modifier and Type | Method and Description |
|---|---|
| public CompletableFuture | |
| public default CompletableFuture | Returns: a future containing the map from each key inkeys to the value associated with
that key; may not contain null valuesthe unique, non-null keys whose values should be loaded keys, Executor the executor with which the entry may be asynchronously loaded with executor)Asynchronously computes or retrieves the values corresponding to |
| public default CompletableFuture | Returns: a future containing the new value associated withkey, or containing
null if the mapping is to be removedthe non-null key whose value should be loaded key, V the non-null old value corresponding to oldValue, Executor keythe executor with which the entry may be asynchronously loaded with executor)Asynchronously computes or retrieves a replacement value corresponding to an already-cached
|
| public static < the key type K, the value type V> AsyncCacheLoader | Returns: an asynchronous cache loader that delegates to the suppliedmappingFunctionthe function to asynchronously compute the values mappingFunction)Returns an asynchronous cache loader that delegates to the supplied mapping function for retrieving the values. |
| public static < the key type K, the value type V> AsyncCacheLoader | Returns: an asynchronous cache loader that delegates to the suppliedmappingFunctionthe function to asynchronously compute the values mappingFunction)Returns an asynchronous cache loader that delegates to the supplied mapping function for retrieving the values. |
| asyncLoad | back to summary |
|---|---|
| public CompletableFuture Asynchronously computes or retrieves the value corresponding to Warning loading must not attempt to update any mappings of this cache directly.
| |
| asyncLoadAll | back to summary |
|---|---|
| public default CompletableFuture Asynchronously computes or retrieves the values corresponding to
If the returned map doesn't contain all requested
This method should be overridden when bulk retrieval is significantly more efficient than many
individual lookups. Note that Warning loading must not attempt to update any mappings of this cache directly.
| |
| asyncReload | back to summary |
|---|---|
| public default CompletableFuture Asynchronously computes or retrieves a replacement value corresponding to an already-cached
Warning loading must not attempt to update any mappings of this cache directly or block waiting for other cache operations to complete. Note all exceptions thrown by this method will be logged and then swallowed.
| |
| bulk | back to summary |
|---|---|
| public static <K, V> AsyncCacheLoader Returns an asynchronous cache loader that delegates to the supplied mapping function for
retrieving the values. Note that Usage example:
| |
| bulk | back to summary |
|---|---|
| public static <K, V> AsyncCacheLoader Returns an asynchronous cache loader that delegates to the supplied mapping function for
retrieving the values. Note that Usage example:
| |