Top Description Inners Fields Methods
com.github.benmanes.caffeine.cache

pack-priv Interface LocalAsyncCache<K, V>

extends AsyncCache<K, V>
Known Direct Implementers
com.github.benmanes.caffeine.cache.LocalAsyncLoadingCache, com.github.benmanes.caffeine.cache.UnboundedLocalCache.UnboundedLocalAsyncCache, com.github.benmanes.caffeine.cache.BoundedLocalCache.BoundedLocalAsyncCache
Static Imports
com.github.benmanes.caffeine.cache.Caffeine.calculateHashMapCapacity, .Caffeine.requireState, java.util.Objects.requireNonNull

This class provides a skeletal implementation of the AsyncCache interface to minimize the effort required to implement a LocalCache.
Author
[email protected] (Ben Manes)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
public static class
public static class
public static class
LocalAsyncCache.AsyncBulkCompleter<K, V>

A function executed asynchronously after a bulk load completes.

public static class

Field Summary

Modifier and TypeField and Description
public static final System.Logger

Method Summary

Modifier and TypeMethod and Description
public LocalCache<K, CompletableFuture<V>>
cache()

Returns the backing LocalCache data store.

public static <K, V> CompletableFuture<Map<K, V>>
composeResult(Map<K, CompletableFuture<V>> futures)

Returns a future that waits for all of the dependent futures to complete and returns the combined mapping if successful.

public default CompletableFuture<V>
get(K
the key with which the specified value is to be associated
key
,
Function<? super K, ? extends V>
the function to asynchronously compute a value
mappingFunction
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.get.

Returns the future associated with the key in this cache, obtaining that value from mappingFunction if necessary.
public default CompletableFuture<V>
get(K
the key with which the specified value is to be associated
key
,
BiFunction<? super K, ? super Executor, ? extends CompletableFuture<? extends V>>
the function to asynchronously compute a value, optionally using the given executor
mappingFunction
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.get.

Returns the future associated with the key in this cache, obtaining that value from mappingFunction if necessary.
public default CompletableFuture<V>
get(K key, BiFunction<? super K, ? super Executor, ? extends CompletableFuture<? extends V>> mappingFunction, boolean recordStats)

public default CompletableFuture<Map<K, V>>
getAll(Iterable<? extends K>
the keys whose associated values are to be returned
keys
,
Function<? super Set<? extends K>, ? extends Map<? extends K, ? extends V>>
the function to asynchronously compute the values
mappingFunction
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.getAll.

Returns the future of a map of the values associated with the keys, creating or retrieving those values if necessary.
public default CompletableFuture<Map<K, V>>
getAll(Iterable<? extends K>
the keys whose associated values are to be returned
keys
,
BiFunction<? super Set<? extends K>, ? super Executor, ? extends CompletableFuture<? extends Map<? extends K, ? extends V>>>
the function to asynchronously compute the values, optionally using the given executor
mappingFunction
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.getAll.

Returns the future of a map of the values associated with the keys, creating or retrieving those values if necessary.
public default @Nullable CompletableFuture<V>
getIfPresent(K
the key whose associated value is to be returned
key
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.getIfPresent.

Returns the future associated with the key in this cache, or null if there is no cached future for the key.
public default void
handleCompletion(K key, CompletableFuture<? extends V> valueFuture, long startTime, boolean recordMiss)

public Policy<K, V>
policy()

Returns the policy supported by this implementation and its configuration.

public default void
put(K
the key with which the specified value is to be associated
key
,
CompletableFuture<? extends V>
the value to be associated with the specified key
valueFuture
)

Implements com.github.benmanes.caffeine.cache.AsyncCache.put.

Associates value with key in this cache.
Inherited from com.github.benmanes.caffeine.cache.AsyncCache:
asMapsynchronous