Package org.apache.pekko.http.caching
Class LfuCache<K,V> 
java.lang.Object
org.apache.pekko.http.caching.scaladsl.Cache<K,V>
 
org.apache.pekko.http.caching.LfuCache<K,V> 
- All Implemented Interfaces:
- Cache<K,- V> 
INTERNAL API
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionscala.concurrent.Future<V>Returns either the cached Future for the given key or evaluates the given value generating function producing aFuture[V].voidclear()Clears the cache by removing all entries.static <K,V> Cache<K, V> create(org.apache.pekko.actor.ActorSystem system) Java API Creates a newpekko.http.caching.LfuCacheusing configuration of the system, with optional expiration depending on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.static <K,V> Cache<K, V> create(CachingSettings settings) Java API Creates a newpekko.http.caching.LfuCache, with optional expiration depending on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.scala.Option<scala.concurrent.Future<V>>Retrieves the future instance that is currently in the cache for the given key.scala.concurrent.Future<V>Returns either the cached Future for the given key, or applies the given value loading function on the key, producing aFuture[V].scala.collection.immutable.Set<K>keys()Returns the set of keys in the cache, in no particular order Should return in roughly constant time.scala.concurrent.Future<V>Multiple call to put method for the same key may result in a race condition, the value yield by the last successful future for that key will replace any previously cached value.voidRemoves the cache item for the given key.intsize()Returns the upper bound for the number of currently cached entries.store()static <K,V> BiFunction<K, Executor, CompletableFuture<V>> toJavaMappingFunction(scala.Function0<scala.concurrent.Future<V>> genValue) static <K,V> BiFunction<K, Executor, CompletableFuture<V>> toJavaMappingFunction(scala.Function1<K, scala.concurrent.Future<V>> loadValue) Methods inherited from class org.apache.pekko.http.caching.scaladsl.Cacheapply, get, getFuture, getKeys, getOptional, getOrCreateStrict, getOrFulfil
- 
Constructor Details- 
LfuCache
 
- 
- 
Method Details- 
createJava API Creates a newpekko.http.caching.LfuCacheusing configuration of the system, with optional expiration depending on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.- Parameters:
- system- (undocumented)
- Returns:
- (undocumented)
 
- 
createJava API Creates a newpekko.http.caching.LfuCache, with optional expiration depending on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.- Parameters:
- settings- (undocumented)
- Returns:
- (undocumented)
 
- 
toJavaMappingFunctionpublic static <K,V> BiFunction<K,Executor, toJavaMappingFunctionCompletableFuture<V>> (scala.Function0<scala.concurrent.Future<V>> genValue) 
- 
toJavaMappingFunctionpublic static <K,V> BiFunction<K,Executor, toJavaMappingFunctionCompletableFuture<V>> (scala.Function1<K, scala.concurrent.Future<V>> loadValue) 
- 
store
- 
getDescription copied from class:CacheRetrieves the future instance that is currently in the cache for the given key. Returns None if the key has no corresponding cache entry.
- 
applypublic scala.concurrent.Future<V> apply(K key, scala.Function0<scala.concurrent.Future<V>> genValue) Description copied from class:CacheReturns either the cached Future for the given key or evaluates the given value generating function producing aFuture[V].
- 
putpublic scala.concurrent.Future<V> put(K key, scala.concurrent.Future<V> mayBeValue, scala.concurrent.ExecutionContext ex) Multiple call to put method for the same key may result in a race condition, the value yield by the last successful future for that key will replace any previously cached value.
- 
getOrLoadpublic scala.concurrent.Future<V> getOrLoad(K key, scala.Function1<K, scala.concurrent.Future<V>> loadValue) Description copied from class:CacheReturns either the cached Future for the given key, or applies the given value loading function on the key, producing aFuture[V].
- 
removeDescription copied from class:CacheRemoves the cache item for the given key.
- 
clearpublic void clear()Description copied from class:CacheClears the cache by removing all entries.
- 
keysDescription copied from class:CacheReturns 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).
- 
sizepublic int size()Description copied from class:CacheReturns 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).
 
-