Class Async.AsyncWeigher<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.Async.AsyncWeigher<K,V>
-
- All Implemented Interfaces:
Weigher<K,java.util.concurrent.CompletableFuture<V>>
,java.io.Serializable
- Enclosing class:
- Async
static final class Async.AsyncWeigher<K,V> extends java.lang.Object implements Weigher<K,java.util.concurrent.CompletableFuture<V>>, java.io.Serializable
A weigher for asynchronous computations. When the value is being loaded this weigher returns0
to indicate that the entry should not be evicted due to a size constraint. If the value is computed successfully the entry must be reinserted so that the weight is updated and the expiration timeouts reflect the value once present. This can be done safely usingMap.replace(Object, Object, Object)
.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Weigher<K,V>
delegate
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description AsyncWeigher(Weigher<K,V> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
weigh(K key, java.util.concurrent.CompletableFuture<V> future)
Returns the weight of a cache entry.(package private) java.lang.Object
writeReplace()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
weigh
public int weigh(K key, java.util.concurrent.CompletableFuture<V> future)
Description copied from interface:Weigher
Returns the weight of a cache entry. There is no unit for entry weights; rather they are simply relative to each other.
-
writeReplace
java.lang.Object writeReplace()
-
-