Package org.infinispan.api.sync
Interface SyncCache<K,V>
public interface SyncCache<K,V>
- Since:
- 14.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclear()Clear the store.voidclear(CacheOptions options) Clear the store.Returns the configuration of this cacheReturn the container of this cachedefault CloseableIterable<CacheEntry<K, V>> entries()Retrieve all entriesentries(CacheOptions options) Retrieve all entriesdefault longEstimate the size of the storelongestimateSize(CacheOptions options) Estimate the size of the storedefault VGet the value of the Key if such existsdefault Vget(K key, CacheOptions options) Get the value of the Key if such existsRetrieves all entries for the supplied keysgetAll(Set<K> keys, CacheOptions options) Retrieves all entries for the supplied keysRetrieves all entries for the supplied keysgetAll(CacheOptions options, K... keys) Retrieves all entries for the supplied keysdefault CacheEntry<K, V> getAndRemove(K key) Removes the key and returns its value if present.CacheEntry<K, V> getAndRemove(K key, CacheOptions options) Removes the key and returns its value if present.default Map<K, CacheEntry<K, V>> getAndRemoveAll(Set<K> keys) Removes a set of keys.default Map<K, CacheEntry<K, V>> getAndRemoveAll(Set<K> keys, CacheWriteOptions options) Removes a set of keys.default CacheEntry<K, V> Get the entry of the Key if such existsCacheEntry<K, V> getEntry(K key, CacheOptions options) Get the entry of the Key if such existsdefault CacheEntry<K, V> getOrReplaceEntry(K key, V value, CacheEntryVersion version) CacheEntry<K, V> getOrReplaceEntry(K key, V value, CacheEntryVersion version, CacheWriteOptions options) default CloseableIterable<K> keys()Retrieve all keyskeys(CacheOptions options) Retrieve all keyslisten(SyncCacheEntryListener<K, V> listener) Listens to theSyncCacheEntryListenername()Returns the name of this cachedefault <T> Set<CacheEntryProcessorResult<K, T>> Process entries using the supplied processor<T> Set<CacheEntryProcessorResult<K, T>> process(Set<K> keys, SyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Process entries using the supplied processordefault <T> Set<CacheEntryProcessorResult<K, T>> processAll(SyncCacheEntryProcessor<K, V, T> processor) Process entries using the supplied processor<T> Set<CacheEntryProcessorResult<K, T>> processAll(SyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Process entries using the supplied processordefault CacheEntry<K, V> Insert the key/value pair.CacheEntry<K, V> put(K key, V value, CacheWriteOptions options) default voidPuts all entriesvoidputAll(Map<K, V> entries, CacheWriteOptions options) default CacheEntry<K, V> putIfAbsent(K key, V value) Save the key/value.CacheEntry<K, V> putIfAbsent(K key, V value, CacheWriteOptions options) Insert the key/value if such key does not existFind by queryquery(String query, CacheOptions options) Find by querydefault booleanDelete the keydefault booleanremove(K key, CacheEntryVersion version) Delete the key only if the version matchesbooleanremove(K key, CacheEntryVersion version, CacheOptions options) Delete the key only if the version matchesdefault booleanremove(K key, CacheOptions options) Delete the keyRemoves a set of keys.removeAll(Set<K> keys, CacheWriteOptions options) Removes a set of keys.default booleanreplace(K key, V value, CacheEntryVersion version) default booleanreplace(K key, V value, CacheEntryVersion version, CacheWriteOptions options) default voidSimilar toput(Object, Object)but does not return the previous value.default voidset(K key, V value, CacheWriteOptions options) default booleansetIfAbsent(K key, V value) Save the key/value.default booleansetIfAbsent(K key, V value, CacheWriteOptions options) Insert the key/value if such key does not exist
-
Method Details
-
name
String name()Returns the name of this cache- Returns:
- the name of the cache
-
configuration
CacheConfiguration configuration()Returns the configuration of this cache- Returns:
- the cache configuration
-
container
SyncContainer container()Return the container of this cache- Returns:
- the cache container
-
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-- 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
-
put
Insert the key/value pair. Returns the previous value if present.- Parameters:
key-value-- Returns:
- Void
-
put
- Parameters:
key-value-options-- Returns:
- Void
-
set
Similar toput(Object, Object)but does not return the previous value. -
set
- Parameters:
key-value-options-
-
putIfAbsent
Save the key/value.- 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
Save the key/value.- Parameters:
key-value-- Returns:
- true if the entry was set
-
setIfAbsent
Insert the key/value if such key does not exist- Parameters:
key-value-options-- Returns:
- Void
-
replace
- Parameters:
key-value-- Returns:
-
replace
- Parameters:
key-value-options-- Returns:
-
getOrReplaceEntry
- Parameters:
key-value-version-- Returns:
-
getOrReplaceEntry
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:
- true if the entry was removed
-
remove
Delete the key- Parameters:
key-options-- Returns:
- true if 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
Puts all entries- Parameters:
entries-
-
putAll
- Parameters:
entries-options-
-
getAll
Retrieves all entries for the supplied keys- Parameters:
keys-- Returns:
-
getAll
Retrieves all entries for the supplied keys- Parameters:
keys-options-- Returns:
-
getAll
Retrieves all entries for the supplied keys- Parameters:
keys-- Returns:
-
getAll
Retrieves all entries for the supplied 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:
-
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-- Returns:
-
estimateSize
default long estimateSize()Estimate the size of the store- Returns:
- Long, estimated size
-
estimateSize
Estimate the size of the store- Returns:
- Long, estimated size
-
clear
default void clear()Clear the store. If a concurrent operation puts data in the store the clear might not properly work. -
clear
Clear the store. If a concurrent operation puts data in the store the clear might not properly work. -
query
Find by query- Parameters:
query-- Returns:
-
query
Find by query- Type Parameters:
R-- Parameters:
query-options-- Returns:
-
listen
Listens to theSyncCacheEntryListener- Parameters:
listener-- Returns:
- A
AutoCloseablethat allows to remove the listener viaAutoCloseable.close().
-
process
default <T> Set<CacheEntryProcessorResult<K,T>> process(Set<K> keys, SyncCacheEntryProcessor<K, V, T> processor) Process entries using the supplied processor- Type Parameters:
T-- Parameters:
keys-processor-
-
process
<T> Set<CacheEntryProcessorResult<K,T>> process(Set<K> keys, SyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Process entries using the supplied processor- Type Parameters:
T-- Parameters:
keys-processor-options-
-
processAll
default <T> Set<CacheEntryProcessorResult<K,T>> processAll(SyncCacheEntryProcessor<K, V, T> processor) Process entries using the supplied processor- Type Parameters:
T-- Parameters:
processor-
-
processAll
<T> Set<CacheEntryProcessorResult<K,T>> processAll(SyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options) Process entries using the supplied processor- Type Parameters:
T-- Parameters:
processor-options-
-
streaming
SyncStreamingCache<K> streaming()- Returns:
-