Package akka.http.caching.javadsl
Interface Cache<K,V>
@ApiMayChange
@DoNotInherit
public interface Cache<K,V>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the cache by removing all entries.getFuture
(K key, akka.japi.Creator<CompletionStage<V>> genValue) Returns either the cached CompletionStage for the given key or evaluates the given value generating function producing a `CompletionStage`. getKeys()
Returns the set of keys in the cache, in no particular order Should return in roughly constant time.getOptional
(K key) Retrieves the CompletionStage instance that is currently in the cache for the given key.getOrCreateStrict
(K key, akka.japi.Creator<V> block) Returns either the cached CompletionStage for the given key or the given value as a CompletionStagegetOrFulfil
(K key, akka.japi.Procedure<CompletableFuture<V>> f) Returns either the cachedCompletionStage
for the key, or evaluates the given function which should lead to eventual completion of the completable future.void
Removes the cache item for the given key.int
size()
Returns the upper bound for the number of currently cached entries.
-
Method Details
-
getFuture
Returns either the cached CompletionStage for the given key or evaluates the given value generating function producing a `CompletionStage`. -
getOrFulfil
Returns either the cachedCompletionStage
for the key, or evaluates the given function which should lead to eventual completion of the completable future. -
getOrCreateStrict
Returns either the cached CompletionStage for the given key or the given value as a CompletionStage -
getOptional
Retrieves the CompletionStage instance that is currently in the cache for the given key. Returns None if the key has no corresponding cache entry. -
remove
Removes the cache item for the given key. -
clear
void clear()Clears the cache by removing all entries. -
getKeys
Returns the set of keys in the cache, in no particular order Should return in roughly constant time. Note that this number might not reflect the exact keys of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint). -
size
int size()Returns the upper bound for the number of currently cached entries. Note that this number might not reflect the exact number of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).
-