@Tags(value={"distributed","client","cluster","map","cache"}) @CapabilityDescription(value="Provides the ability to communicate with a DistributedMapCacheServer. This allows multiple nodes to coordinate state with a single remote entity.") public interface DistributedMapCacheClient extends ControllerService
Map
.Modifier and Type | Method and Description |
---|---|
void |
close()
Attempts to notify the server that we are finished communicating with it
and cleans up resources
|
<K> boolean |
containsKey(K key,
Serializer<K> keySerializer)
Determines if the given value is present in the cache and if so returns
true , else returns false |
<K,V> V |
get(K key,
Serializer<K> keySerializer,
Deserializer<V> valueDeserializer)
Returns the value in the cache for the given key, if one exists;
otherwise returns
null |
<K,V> V |
getAndPutIfAbsent(K key,
V value,
Serializer<K> keySerializer,
Serializer<V> valueSerializer,
Deserializer<V> valueDeserializer)
Adds the specified key and value to the cache, if they are not already
present, serializing the key and value with the given
Serializer s. |
default <K> Set<K> |
keySet(Deserializer<K> keyDeserializer)
Returns a set of all keys currently in the cache
|
<K,V> void |
put(K key,
V value,
Serializer<K> keySerializer,
Serializer<V> valueSerializer)
Adds the specified key and value to the cache, overwriting any value that is
currently set.
|
default <K,V> void |
putAll(Map<K,V> keysAndValues,
Serializer<K> keySerializer,
Serializer<V> valueSerializer)
Performs a bulk put operation.
|
<K,V> boolean |
putIfAbsent(K key,
V value,
Serializer<K> keySerializer,
Serializer<V> valueSerializer)
Adds the specified key and value to the cache, if they are not already
present, serializing the key and value with the given
Serializer s. |
<K> boolean |
remove(K key,
Serializer<K> serializer)
Removes the entry with the given key from the cache, if it is present.
|
default <K,V> V |
removeAndGet(K key,
Serializer<K> keySerializer,
Deserializer<V> valueDeserializer)
Removes the entry with the given key from the cache, if it is present,
and returns the value that was removed from the map.
|
long |
removeByPattern(String regex)
Removes entries whose keys match the specified pattern
|
default <K,V> Map<K,V> |
removeByPatternAndGet(String regex,
Deserializer<K> keyDeserializer,
Deserializer<V> valueDeserializer)
Removes entries whose keys match the specified pattern, and returns a map of entries that
were removed.
|
default <K,V> Map<K,V> |
subMap(Set<K> keys,
Serializer<K> keySerializer,
Deserializer<V> valueDeserializer)
Returns the values in the cache for the given keys, if they exist;
otherwise returns
null |
initialize
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
<K,V> boolean putIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException
Serializer
s.K
- type of keyV
- type of valuekey
- the key for into the mapvalue
- the value to add to the map if and only if the key is absentkeySerializer
- key serializervalueSerializer
- value serializerIOException
- if unable to communicate with the remote instance<K,V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException
Serializer
s. If a value already exists in the cache for the given
key, the value associated with the key is returned, after being
deserialized with the given valueDeserializer.K
- type of keyV
- type of valuekey
- keyvalue
- valuekeySerializer
- key serializervalueSerializer
- key serializervalueDeserializer
- value deserializervalueDeserializer
. If the key does not
exist, the key and its value will be added to the cache.IOException
- ex<K> boolean containsKey(K key, Serializer<K> keySerializer) throws IOException
true
, else returns false
K
- type of keykey
- keykeySerializer
- key serializertrue
, else returns false
IOException
- if unable to communicate with the remote instance<K,V> void put(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException
K
- the key typeV
- the value typekey
- The key to setvalue
- The value to associate with the given KeykeySerializer
- the Serializer that will be used to serialize the key into bytesvalueSerializer
- the Serializer that will be used to serialize the value into bytesIOException
- if unable to communicate with the remote instanceNullPointerException
- if the key or either serializer is nulldefault <K,V> void putAll(Map<K,V> keysAndValues, Serializer<K> keySerializer, Serializer<V> valueSerializer) throws IOException
K
- The key typeV
- The value typekeysAndValues
- A java.util.Map that contains an association between keys and values to be bulk inserted into the cache.keySerializer
- The Serializer that will be used to serialize the key into bytesvalueSerializer
- The Serializer that will be used to serialize the value into bytesIOException
- if unable to communicate with the remote instance<K,V> V get(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException
null
K
- the key typeV
- the value typekey
- the key to lookup in the mapkeySerializer
- key serializervalueDeserializer
- value serializernull
IOException
- exdefault <K,V> Map<K,V> subMap(Set<K> keys, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException
null
K
- the key typeV
- the value typekeys
- a set of keys whose values to lookup in the mapkeySerializer
- key serializervalueDeserializer
- value serializernull
IOException
- exvoid close() throws IOException
IOException
- ex<K> boolean remove(K key, Serializer<K> serializer) throws IOException
K
- type of keykey
- keyserializer
- serializertrue
if the entry is removed, false
if
the key did not exist in the cacheIOException
- exdefault <K,V> V removeAndGet(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException
K
- type of keyV
- type of valuekey
- keykeySerializer
- key serializervalueDeserializer
- value deserializerIOException
- exlong removeByPattern(String regex) throws IOException
regex
- The regular expression / pattern on which to match the keys to be removedIOException
- if any error occurred while removing an entrydefault <K,V> Map<K,V> removeByPatternAndGet(String regex, Deserializer<K> keyDeserializer, Deserializer<V> valueDeserializer) throws IOException
K
- type of keyV
- type of valueregex
- The regular expression / pattern on which to match the keys to be removedkeyDeserializer
- key deserializervalueDeserializer
- value deserializerIOException
- if any error occurred while removing an entrydefault <K> Set<K> keySet(Deserializer<K> keyDeserializer) throws IOException
K
- type of keykeyDeserializer
- key deserializerIOException
- exCopyright © 2020 Apache NiFi Project. All rights reserved.