| Constructor | Description |
|---|---|
ConcurrentSoftCache() |
Creates an unbounded cache with soft-referenced values.
|
ConcurrentSoftCache(java.util.function.Function<K,V> mappingFunction) |
Creates an unbounded cache with soft-referenced values that uses the given mapping function to create values from keys.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object other) |
|
void |
evict(K key) |
Evicts the entry with the given key from this cache.
|
void |
evict(K key,
V value) |
Evicts the entry with the given key and value from this cache.
|
void |
evictAll() |
Evicts all entries from this cache.
|
void |
forEach(java.util.function.BiConsumer<? super K,? super V> action) |
Performs the given action for each entry in this cache until all entries have been processed or the action throws an exception.
|
java.util.Optional<V> |
get(K key) |
Returns the value associated with the given key in this cache.
|
V |
getOrDefault(K key,
V defaultValue) |
Returns the value associated with the given key in this cache.
|
int |
hashCode() |
|
boolean |
isEmpty() |
Checks whether this cache is empty.
|
void |
put(K key,
V value) |
Creates an entry with the given key and value in this cache.
|
void |
putIfAbsent(K key,
V value) |
Creates an entry with the given key and value in this cache only if no entry with the same key already exists.
|
int |
size() |
Returns the number of entries in this cache.
|
java.lang.String |
toString() |
public ConcurrentSoftCache()
public ConcurrentSoftCache(java.util.function.Function<K,V> mappingFunction)
java.lang.IllegalArgumentException - if mappingFunction is nullpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic void evict(K key)
Cachepublic void evict(K key, V value)
Cachepublic void evictAll()
Cachepublic void forEach(java.util.function.BiConsumer<? super K,? super V> action)
Cachepublic java.util.Optional<V> get(K key)
Cachepublic V getOrDefault(K key, V defaultValue)
CachegetOrDefault in interface Cache<K,V>Map.getOrDefault(Object, Object)public int hashCode()
hashCode in class java.lang.Objectpublic boolean isEmpty()
Cachepublic void put(K key, V value)
Cachepublic void putIfAbsent(K key, V value)
CacheputIfAbsent in interface Cache<K,V>Map.putIfAbsent(Object, Object)public int size()
Cachepublic java.lang.String toString()
toString in class java.lang.Object