Package org.infinispan.multimap.impl
Class EmbeddedMultimapPairCache<K,HK,HV>
java.lang.Object
org.infinispan.multimap.impl.EmbeddedMultimapPairCache<K,HK,HV>
- Type Parameters:
K
- : The type of key to identify the structure.HK
- : The structure type for keys.HV
- : The structure type for values.
Multimap which holds a collection of key-values pairs.
This multimap can create arbitrary objects by holding a collection of key-value pairs under a single cache entry. It is possible to add or remove attributes dynamically, varying the structure format between keys.
Note that the structure is not distributed, it is under a single key, and the distribution happens per key.- Since:
- 15.0
- Author:
- José Bolina
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionExecute the given on the value mapped to the stored under .Verify if the property is present in the hash map stored under the given key.Get the key-value pairs under the given key.final CompletionStage
<Map<HK, HV>> Return the values of the given stored under the given .Get the key set from the hash map stored under the given key.final CompletionStage
<Integer> Remove the properties in the hash map under the given key.final CompletionStage
<Integer> remove
(K key, Collection<HK> properties) Remove the given properties in the hash map stored under the given key.final CompletionStage
<Integer> Set the given key-value pair in the multimap under the given key.final CompletionStage
<Boolean> setIfAbsent
(K key, HK propertyKey, HV propertyValue) Set the given key-value in the multimap under the given key.Get the size of the hash map stored under key.Select key-value pairs from the hash map stored under the given key.Get the values from the hash map stored under the given key.
-
Field Details
-
ERR_KEY_CAN_T_BE_NULL
- See Also:
-
ERR_PROPERTY_CANT_BE_NULL
- See Also:
-
ERR_VALUE_CANT_BE_NULL
- See Also:
-
ERR_PROPERTIES_CANT_BE_EMPTY
- See Also:
-
ERR_COUNT_MUST_BE_POSITIVE
- See Also:
-
-
Constructor Details
-
EmbeddedMultimapPairCache
-
-
Method Details
-
set
Set the given key-value pair in the multimap under the given key. If the key is not present, a new multimap is created.- Parameters:
key
- : Cache key to store the values.entries
- : Key-value pairs to store.- Returns:
CompletionStage
with the number of created entries.
-
setIfAbsent
Set the given key-value in the multimap under the given key.If the key is not present, a new multimap is created. If the property already exists, the operation has no effect.
- Parameters:
key
- : Cache key to store key-value pair.propertyKey
- : The property key.propertyValue
- : The property value.- Returns:
true
if the value is set,false
, otherwise.
-
get
Get the key-value pairs under the given key.- Parameters:
key
- : Cache key to retrieve the values.- Returns:
CompletionStage
containing aMap
with the key-value pairs or an empty map if the key is not found.
-
get
-
get
Return the values of the given stored under the given .- Parameters:
key
- : Cache key to retrieve the hash map.properties
- : Properties to retrieve.- Returns:
CompletionStage
containing aMap
with the key-value pairs or an empty map if the key is not found.
-
size
Get the size of the hash map stored under key.- Parameters:
key
- : Cache key to retrieve the hash map.- Returns:
CompletionStage
containing the size of the hash map or 0 if the key is not found.
-
keySet
Get the key set from the hash map stored under the given key.- Parameters:
key
- : Cache key to retrieve the hash map.- Returns:
CompletionStage
containing aSet
with the keys or an empty set if the key is not found.
-
values
Get the values from the hash map stored under the given key.- Parameters:
key
- : Cache key to retrieve the hash map.- Returns:
CompletionStage
containing aCollection
with the values or an empty collection if the key is not found.
-
contains
Verify if the property is present in the hash map stored under the given key.- Parameters:
key
- : Cache key to retrieve the hash map.property
- : Property to verify in the hash map.- Returns:
CompletionStage
withtrue
if the property is present orfalse
otherwise.
-
remove
Remove the properties in the hash map under the given key.- Parameters:
key
- : Cache key to remove the properties.property
- : Property to remove.properties
- : Additional properties to remove.- Returns:
CompletionStage
with the number of removed properties.
-
remove
Remove the given properties in the hash map stored under the given key.- Parameters:
key
- : Cache key to remove the properties.properties
- : Properties to remove.- Returns:
CompletionStage
with the number of removed properties.
-
compute
Execute the given on the value mapped to the stored under .If the key is not present, a new entry is created. The is executed until the value is replaced with the new value. This is implementation behaves like
Map.compute(Object, BiFunction)
.- Parameters:
key
- : The key to retrieve theHashMapBucket
.property
- : The property to be updated.biConsumer
- : Receives the key and previous value and returns the new value.- Returns:
- A
CompletionStage
with the new value returned from . - See Also:
-
subSelect
Select key-value pairs from the hash map stored under the given key.The returned values are randomly selected from the underlying map. An bigger than the size of the stored map does not raise an exception.
- Parameters:
key
- : Cache key to retrieve the stored hash map.count
- : Number of key-value pairs to select.- Returns:
CompletionStage
containing aMap
with the key-value pairs or null if not found.
-