Constructor and Description |
---|
LfuCache(com.github.benmanes.caffeine.cache.AsyncCache<K,V> store) |
Modifier and Type | Method and Description |
---|---|
scala.concurrent.Future<V> |
apply(K key,
scala.Function0<scala.concurrent.Future<V>> genValue)
Returns either the cached Future for the given key or evaluates the given value generating
function producing a
Future[V] . |
void |
clear()
Clears the cache by removing all entries.
|
static <K,V> Cache<K,V> |
create(org.apache.pekko.actor.ActorSystem system)
Java API
Creates a new
pekko.http.caching.LfuCache using 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 new
pekko.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>> |
get(K key)
Retrieves the future instance that is currently in the cache for the given key.
|
scala.concurrent.Future<V> |
getOrLoad(K key,
scala.Function1<K,scala.concurrent.Future<V>> loadValue)
Returns either the cached Future for the given key, or applies the given value loading
function on the key, producing a
Future[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> |
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.
|
void |
remove(K key)
Removes the cache item for the given key.
|
int |
size()
Returns the upper bound for the number of currently cached entries.
|
com.github.benmanes.caffeine.cache.AsyncCache<K,V> |
store() |
static <K,V> java.util.function.BiFunction<K,java.util.concurrent.Executor,java.util.concurrent.CompletableFuture<V>> |
toJavaMappingFunction(scala.Function0<scala.concurrent.Future<V>> genValue) |
static <K,V> java.util.function.BiFunction<K,java.util.concurrent.Executor,java.util.concurrent.CompletableFuture<V>> |
toJavaMappingFunction(scala.Function1<K,scala.concurrent.Future<V>> loadValue) |
apply, get, getFuture, getKeys, getOptional, getOrCreateStrict, getOrFulfil
public static <K,V> Cache<K,V> create(org.apache.pekko.actor.ActorSystem system)
pekko.http.caching.LfuCache
using configuration of the system,
with optional expiration depending on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.system
- (undocumented)public static <K,V> Cache<K,V> create(CachingSettings settings)
pekko.http.caching.LfuCache
, with optional expiration depending
on whether a non-zero and finite timeToLive and/or timeToIdle is set or not.settings
- (undocumented)public static <K,V> java.util.function.BiFunction<K,java.util.concurrent.Executor,java.util.concurrent.CompletableFuture<V>> toJavaMappingFunction(scala.Function0<scala.concurrent.Future<V>> genValue)
public static <K,V> java.util.function.BiFunction<K,java.util.concurrent.Executor,java.util.concurrent.CompletableFuture<V>> toJavaMappingFunction(scala.Function1<K,scala.concurrent.Future<V>> loadValue)
public scala.Option<scala.concurrent.Future<V>> get(K key)
Cache
public scala.concurrent.Future<V> apply(K key, scala.Function0<scala.concurrent.Future<V>> genValue)
Cache
Future[V]
.public scala.concurrent.Future<V> put(K key, scala.concurrent.Future<V> mayBeValue, scala.concurrent.ExecutionContext ex)
public scala.concurrent.Future<V> getOrLoad(K key, scala.Function1<K,scala.concurrent.Future<V>> loadValue)
Cache
Future[V]
.public void remove(K key)
Cache
public void clear()
Cache
public scala.collection.immutable.Set<K> keys()
Cache
public int size()
Cache