Package org.infinispan.api.async
Interface AsyncCache<K,V>
public interface AsyncCache<K,V>
- Since:
- 14.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletionStage
<Void> clear()
Clear the cache.clear
(CacheOptions options) Clear the cache.The configuration for this cache.Return the container of this cachedefault Flow.Publisher
<CacheEntry<K, V>> entries()
Retrieve all entriesentries
(CacheOptions options) Retrieve all entriesdefault CompletionStage
<Long> Estimate the size of the storeestimateSize
(CacheOptions options) Estimate the size of the storedefault CompletionStage
<V> Get the value of the Key if such existsdefault CompletionStage
<V> get
(K key, CacheOptions options) Get the value of the Key if such existsdefault Flow.Publisher
<CacheEntry<K, V>> Retrieves the entries for the specified keys.getAll
(Set<K> keys, CacheOptions options) Retrieves the entries for the specified keys.default Flow.Publisher
<CacheEntry<K, V>> Retrieves the entries for the specified keys.getAll
(CacheOptions options, K... keys) Retrieves the entries for the specified keys.default CompletionStage
<CacheEntry<K, V>> getAndRemove
(K key) Removes the key and returns its value if present.getAndRemove
(K key, CacheOptions options) Removes the key and returns its value if present.default Flow.Publisher
<CacheEntry<K, V>> getAndRemoveAll
(Flow.Publisher<K> keys) Removes a set of keys.getAndRemoveAll
(Flow.Publisher<K> keys, CacheWriteOptions options) Removes a set of keys.default Flow.Publisher
<CacheEntry<K, V>> getAndRemoveAll
(Set<K> keys) Removes a set of keys.getAndRemoveAll
(Set<K> keys, CacheWriteOptions options) Removes a set of keys.default CompletionStage
<CacheEntry<K, V>> Get the entry of the Key if such existsgetEntry
(K key, CacheOptions options) Get the entry of the Key if such existsdefault CompletionStage
<CacheEntry<K, V>> getOrReplaceEntry
(K key, V value, CacheEntryVersion version) getOrReplaceEntry
(K key, V value, CacheEntryVersion version, CacheWriteOptions options) default Flow.Publisher
<K> keys()
Retrieve all keyskeys
(CacheOptions options) Retrieve all keysdefault Flow.Publisher
<CacheEntryEvent<K, V>> listen
(CacheEntryEventType... types) Register a cache listener with defaultCacheListenerOptions
listen
(CacheListenerOptions options, CacheEntryEventType... types) Register a cache listener with the suppliedCacheListenerOptions
name()
The name of the cache.default <T> Flow.Publisher
<CacheEntryProcessorResult<K, T>> Process entries using the supplied task<T> Flow.Publisher
<CacheEntryProcessorResult<K, T>> process
(Set<K> keys, AsyncCacheEntryProcessor<K, V, T> task, CacheOptions options) Process entries using the supplied taskdefault <T> Flow.Publisher
<CacheEntryProcessorResult<K, T>> processAll
(AsyncCacheEntryProcessor<K, V, T> processor) Execute aCacheProcessor
on a cache<T> Flow.Publisher
<CacheEntryProcessorResult<K, T>> processAll
(AsyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Execute aCacheProcessor
on a cachedefault CompletionStage
<CacheEntry<K, V>> put
(K key, V value, CacheWriteOptions options) default CompletionStage
<Void> putAll
(Flow.Publisher<CacheEntry<K, V>> entries) putAll
(Flow.Publisher<CacheEntry<K, V>> entries, CacheWriteOptions options) default CompletionStage
<Void> putAll
(Map<K, V> entries, CacheWriteOptions options) default CompletionStage
<CacheEntry<K, V>> putIfAbsent
(K key, V value) Insert the key/value if such key does not existputIfAbsent
(K key, V value, CacheWriteOptions options) Insert the key/value if such key does not existdefault <R> AsyncQuery
<K, V, R> <R> AsyncQuery
<K, V, R> query
(String query, CacheOptions options) Executes the query and returns an iterable with the entriesdefault CompletionStage
<Boolean> Delete the keydefault CompletionStage
<Boolean> remove
(K key, CacheEntryVersion version) Delete the key only if the version matchesremove
(K key, CacheEntryVersion version, CacheOptions options) Delete the key only if the version matchesremove
(K key, CacheOptions options) Delete the keydefault Flow.Publisher
<K> removeAll
(Flow.Publisher<K> keys) removeAll
(Flow.Publisher<K> keys, CacheWriteOptions options) default Flow.Publisher
<K> Removes a set of keys.removeAll
(Set<K> keys, CacheWriteOptions options) Removes a set of keys.default CompletionStage
<Boolean> replace
(K key, V value, CacheEntryVersion version) default CompletionStage
<Boolean> replace
(K key, V value, CacheEntryVersion version, CacheWriteOptions options) default CompletionStage
<Void> default CompletionStage
<Void> set
(K key, V value, CacheWriteOptions options) default CompletionStage
<Boolean> setIfAbsent
(K key, V value) Insert the key/value if such key does not existdefault CompletionStage
<Boolean> setIfAbsent
(K key, V value, CacheWriteOptions options) Insert the key/value if such key does not exist
-
Method Details
-
name
String name()The name of the cache.- Returns:
-
configuration
CompletionStage<CacheConfiguration> configuration()The configuration for this cache.- Returns:
-
container
AsyncContainer container()Return the container of this cache- Returns:
-
get
Get the value of the Key if such exists- Parameters:
key
-- Returns:
- the value
-
get
Get the value of the Key if such exists- Parameters:
key
-options
-- Returns:
- the value
-
getEntry
Get the entry of the Key if such exists- Parameters:
key
-- Returns:
- the entry
-
getEntry
Get the entry of the Key if such exists- Parameters:
key
-options
-- Returns:
- the entry
-
putIfAbsent
Insert the key/value if such key does not exist- Parameters:
key
-value
-- Returns:
- the previous value if present
-
putIfAbsent
Insert the key/value if such key does not exist- Parameters:
key
-value
-options
-- Returns:
- the previous value if present
-
setIfAbsent
Insert the key/value if such key does not exist- Parameters:
key
-value
-- Returns:
-
setIfAbsent
Insert the key/value if such key does not exist- Parameters:
key
-value
-options
-- Returns:
- Void
-
put
- Parameters:
key
-value
-- Returns:
- Void
-
put
- Parameters:
key
-value
-options
-- Returns:
- Void
-
set
- Parameters:
key
-value
-- Returns:
-
set
- Parameters:
key
-value
-options
-- Returns:
-
replace
- Parameters:
key
-value
-- Returns:
-
replace
default CompletionStage<Boolean> replace(K key, V value, CacheEntryVersion version, CacheWriteOptions options) - Parameters:
key
-value
-options
-- Returns:
-
getOrReplaceEntry
default CompletionStage<CacheEntry<K,V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version) - Parameters:
key
-value
-version
-- Returns:
-
getOrReplaceEntry
CompletionStage<CacheEntry<K,V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version, CacheWriteOptions options) - Parameters:
key
-value
-version
-options
-- Returns:
-
remove
Delete the key- Parameters:
key
-- Returns:
- whether the entry was removed.
-
remove
Delete the key- Parameters:
key
-options
-- Returns:
- whether the entry was removed.
-
remove
Delete the key only if the version matches- Parameters:
key
-version
-- Returns:
- whether the entry was removed.
-
remove
Delete the key only if the version matches- Parameters:
key
-version
-options
-- Returns:
- whether the entry was removed.
-
getAndRemove
Removes the key and returns its value if present.- Parameters:
key
-- Returns:
- the value of the key before removal. Returns null if the key didn't exist.
-
getAndRemove
Removes the key and returns its value if present.- Parameters:
key
-options
-- Returns:
- the value of the key before removal. Returns null if the key didn't exist.
-
keys
Retrieve all keys- Returns:
-
keys
Retrieve all keys- Parameters:
options
-- Returns:
-
entries
Retrieve all entries- Returns:
-
entries
Retrieve all entries- Parameters:
options
-- Returns:
-
putAll
- Parameters:
entries
-- Returns:
- Void
-
putAll
- Parameters:
entries
-options
-- Returns:
-
putAll
- Parameters:
entries
-- Returns:
- Void
-
putAll
- Parameters:
entries
-options
-- Returns:
-
getAll
Retrieves the entries for the specified keys.- Parameters:
keys
-- Returns:
-
getAll
Retrieves the entries for the specified keys.- Parameters:
keys
-options
-- Returns:
-
getAll
Retrieves the entries for the specified keys.- Parameters:
keys
-- Returns:
-
getAll
Retrieves the entries for the specified keys.- Parameters:
options
-keys
-- Returns:
-
removeAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-- Returns:
-
removeAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-options
-- Returns:
-
removeAll
- Parameters:
keys
-- Returns:
- Void
-
removeAll
- Parameters:
keys
-options
-- Returns:
-
getAndRemoveAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-- Returns:
-
getAndRemoveAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-options
-- Returns:
-
getAndRemoveAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-- Returns:
-
getAndRemoveAll
Removes a set of keys. Returns the keys that were removed.- Parameters:
keys
-options
-- Returns:
-
estimateSize
Estimate the size of the store- Returns:
- Long, estimated size
-
estimateSize
Estimate the size of the store- Parameters:
options
-- Returns:
- Long, estimated size
-
clear
Clear the cache. If a concurrent operation puts data in the cache the clear might work properly- Returns:
- Void
-
clear
Clear the cache. If a concurrent operation puts data in the cache the clear might not properly work- Parameters:
options
-- Returns:
- Void
-
query
- Type Parameters:
R
-- Parameters:
query
- query String- Returns:
-
query
Executes the query and returns an iterable with the entries- Type Parameters:
R
-- Parameters:
query
- query Stringoptions
-- Returns:
-
listen
Register a cache listener with defaultCacheListenerOptions
- Parameters:
types
-- Returns:
-
listen
Flow.Publisher<CacheEntryEvent<K,V>> listen(CacheListenerOptions options, CacheEntryEventType... types) Register a cache listener with the suppliedCacheListenerOptions
- Parameters:
options
-types
- one or moreCacheEntryEventType
- Returns:
-
process
default <T> Flow.Publisher<CacheEntryProcessorResult<K,T>> process(Set<K> keys, AsyncCacheEntryProcessor<K, V, T> processor) Process entries using the supplied task- Parameters:
keys
-processor
-- Returns:
-
process
<T> Flow.Publisher<CacheEntryProcessorResult<K,T>> process(Set<K> keys, AsyncCacheEntryProcessor<K, V, T> task, CacheOptions options) Process entries using the supplied task- Parameters:
keys
-task
-options
-- Returns:
-
processAll
default <T> Flow.Publisher<CacheEntryProcessorResult<K,T>> processAll(AsyncCacheEntryProcessor<K, V, T> processor) Execute aCacheProcessor
on a cache- Type Parameters:
T
-- Parameters:
processor
-- Returns:
-
processAll
<T> Flow.Publisher<CacheEntryProcessorResult<K,T>> processAll(AsyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Execute aCacheProcessor
on a cache- Type Parameters:
T
-- Parameters:
processor
-options
-- Returns:
-
streaming
AsyncStreamingCache<K> streaming()- Returns:
-