Constructor and Description |
---|
Cache() |
Modifier and Type | Method and Description |
---|---|
abstract 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] . |
scala.concurrent.Future<V> |
apply(K key,
scala.Function1<scala.concurrent.Promise<V>,scala.runtime.BoxedUnit> f)
Returns either the cached Future for the key or evaluates the given function which
should lead to eventual completion of the promise.
|
abstract void |
clear()
Clears the cache by removing all entries.
|
abstract 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> |
get(K key,
scala.Function0<V> block)
Returns either the cached Future for the given key or the given value as a Future
|
java.util.concurrent.CompletionStage<V> |
getFuture(K key,
org.apache.pekko.japi.Creator<java.util.concurrent.CompletionStage<V>> genValue)
Returns either the cached CompletionStage for the given key or evaluates the given value
generating function producing a `CompletionStage
|
java.util.Set<K> |
getKeys()
Returns the set of keys in the cache, in no particular order Should return in roughly constant
time.
|
java.util.Optional<java.util.concurrent.CompletionStage<V>> |
getOptional(K key)
Retrieves the CompletionStage instance that is currently in the cache for the given key.
|
java.util.concurrent.CompletionStage<V> |
getOrCreateStrict(K key,
org.apache.pekko.japi.Creator<V> block)
Returns either the cached CompletionStage for the given key or the given value as a CompletionStage
|
java.util.concurrent.CompletionStage<V> |
getOrFulfil(K key,
org.apache.pekko.japi.Procedure<java.util.concurrent.CompletableFuture<V>> f)
Returns either the cached
CompletionStage for the key, or evaluates the given function
which should lead to eventual completion of the completable future. |
abstract 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] . |
abstract scala.collection.immutable.Set<K> |
keys()
Returns the set of keys in the cache, in no particular order
Should return in roughly constant time.
|
abstract scala.concurrent.Future<V> |
put(K key,
scala.concurrent.Future<V> mayBeValue,
scala.concurrent.ExecutionContext ex)
Cache the given future if not cached previously.
|
abstract void |
remove(K key)
Removes the cache item for the given key.
|
abstract int |
size()
Returns the upper bound for the number of currently cached entries.
|
public abstract scala.concurrent.Future<V> apply(K key, scala.Function0<scala.concurrent.Future<V>> genValue)
Future[V]
.key
- (undocumented)genValue
- (undocumented)public scala.concurrent.Future<V> apply(K key, scala.Function1<scala.concurrent.Promise<V>,scala.runtime.BoxedUnit> f)
key
- (undocumented)f
- (undocumented)public abstract void clear()
public scala.concurrent.Future<V> get(K key, scala.Function0<V> block)
key
- (undocumented)block
- (undocumented)public abstract scala.Option<scala.concurrent.Future<V>> get(K key)
key
- (undocumented)public final java.util.concurrent.CompletionStage<V> getFuture(K key, org.apache.pekko.japi.Creator<java.util.concurrent.CompletionStage<V>> genValue)
Cache
public java.util.Set<K> getKeys()
Cache
public java.util.Optional<java.util.concurrent.CompletionStage<V>> getOptional(K key)
Cache
getOptional
in interface Cache<K,V>
public java.util.concurrent.CompletionStage<V> getOrCreateStrict(K key, org.apache.pekko.japi.Creator<V> block)
getOrCreateStrict
in interface Cache<K,V>
key
- (undocumented)block
- (undocumented)public final java.util.concurrent.CompletionStage<V> getOrFulfil(K key, org.apache.pekko.japi.Procedure<java.util.concurrent.CompletableFuture<V>> f)
Cache
CompletionStage
for the key, or evaluates the given function
which should lead to eventual completion of the completable future.getOrFulfil
in interface Cache<K,V>
public abstract scala.concurrent.Future<V> getOrLoad(K key, scala.Function1<K,scala.concurrent.Future<V>> loadValue)
Future[V]
.key
- (undocumented)loadValue
- (undocumented)public abstract scala.collection.immutable.Set<K> keys()
public abstract scala.concurrent.Future<V> put(K key, scala.concurrent.Future<V> mayBeValue, scala.concurrent.ExecutionContext ex)
key
- (undocumented)mayBeValue
- (undocumented)ex
- (undocumented)public abstract void remove(K key)
public abstract int size()