Package org.infinispan.multimap.impl
Class EmbeddedMultimapCache<K,V>
- java.lang.Object
-
- org.infinispan.multimap.impl.EmbeddedMultimapCache<K,V>
-
- All Implemented Interfaces:
org.infinispan.multimap.api.BasicMultimapCache<K,V>,MultimapCache<K,V>
public class EmbeddedMultimapCache<K,V> extends Object implements MultimapCache<K,V>
Embedded implementation ofMultimapCacheTransactions
EmbeddedMultimapCache supports implicit transactions without blocking. The following methods block when they are called in a explicit transaction context. This limitation could be improved in the following versions if technically possible :BasicMultimapCache.size()BasicMultimapCache.containsEntry(Object, Object)
Duplicates
The current implementation does not support duplicate values on keys.Object.equals(Object)method is used to check if a value is already present in the key. This means that the following code.multimapCache.put("k", "v1").join(); multimapCache.put("k", "v2").join(); multimapCache.put("k", "v2").join(); multimapCache.put("k", "v2").join(); multimapCache.get("k").thenAccept(values -> System.out.println(values.size())); // prints the value 2. "k" -> ["v1", "v2"]- Since:
- 9.2
- Author:
- Katia Aresti, karesti@redhat.com
-
-
Constructor Summary
Constructors Constructor Description EmbeddedMultimapCache(org.infinispan.Cache<K,Bucket<V>> cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Boolean>containsEntry(K key, V value)CompletableFuture<Boolean>containsKey(K key)CompletableFuture<Boolean>containsValue(V value)CompletableFuture<Collection<V>>get(K key)org.infinispan.Cache<K,Bucket<V>>getCache()CompletableFuture<Optional<org.infinispan.container.entries.CacheEntry<K,Collection<V>>>>getEntry(K key)Retrieves a CacheEntry corresponding to a specific key in this multimap cache.CompletableFuture<Void>put(K key, V value)CompletableFuture<Void>remove(Predicate<? super V> p)Asynchronous method.CompletableFuture<Boolean>remove(K key)CompletableFuture<Boolean>remove(K key, V value)CompletableFuture<Long>size()booleansupportsDuplicates()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.multimap.api.embedded.MultimapCache
remove
-
-
-
-
Method Detail
-
put
public CompletableFuture<Void> put(K key, V value)
-
get
public CompletableFuture<Collection<V>> get(K key)
-
getEntry
public CompletableFuture<Optional<org.infinispan.container.entries.CacheEntry<K,Collection<V>>>> getEntry(K key)
Description copied from interface:MultimapCacheRetrieves a CacheEntry corresponding to a specific key in this multimap cache.- Specified by:
getEntryin interfaceMultimapCache<K,V>- Parameters:
key- the key whose associated cache entry is to be returned- Returns:
- the cache entry to which the specified key is mapped, or
Optional.empty()if this multimap contains no mapping for the key
-
remove
public CompletableFuture<Boolean> remove(K key)
-
remove
public CompletableFuture<Boolean> remove(K key, V value)
-
remove
public CompletableFuture<Void> remove(Predicate<? super V> p)
Description copied from interface:MultimapCacheAsynchronous method. Removes every value that match thePredicate.This method is blocking used in a explicit transaction context.
- Specified by:
removein interfaceMultimapCache<K,V>- Parameters:
p- the predicate to be tested on every value in this multimap cache- Returns:
CompletableFuturecontaining aVoid
-
containsKey
public CompletableFuture<Boolean> containsKey(K key)
-
containsValue
public CompletableFuture<Boolean> containsValue(V value)
-
containsEntry
public CompletableFuture<Boolean> containsEntry(K key, V value)
-
size
public CompletableFuture<Long> size()
-
supportsDuplicates
public boolean supportsDuplicates()
-
-