public interface GridClientData
GridClient.data(String)
method.
GridClientData
API will be affinity-aware unless
such behavior is overridden by pinning one or more remote nodes
(see pinNodes(GridClientNode, GridClientNode...)
for more information).Modifier and Type | Method and Description |
---|---|
<K> UUID |
affinity(K key)
Gets affinity node ID for provided key.
|
<K,V> boolean |
append(K key,
V val)
Append requested value to already cached one.
|
<K,V> GridClientFuture<Boolean> |
appendAsync(K key,
V val)
Append requested value to already cached one.
|
GridClientDataMetrics |
cachedMetrics()
Tries to get metrics from local cache.
|
String |
cacheName()
Gets name of the remote cache.
|
<K,V> boolean |
cas(K key,
V val1,
V val2)
Sets entry value to
val1 if current value is val2 with
following conditions:
If val1 is null and val2 is equal to current value,
entry is removed from cache. |
<K,V> GridClientFuture<Boolean> |
casAsync(K key,
V val1,
V val2)
Asynchronously sets entry value to
val1 if current value is val2
with following conditions:
If val1 is null and val2 is equal to current value,
entry is removed from cache. |
Set<GridClientCacheFlag> |
flags()
Gets cache flags enabled on this data projection.
|
GridClientData |
flagsOff(GridClientCacheFlag... flags)
Creates new client data object with disabled cache flags.
|
GridClientData |
flagsOn(GridClientCacheFlag... flags)
Creates new client data object with enabled cache flags.
|
<K,V> V |
get(K key)
Gets value from cache on remote node.
|
<K,V> Map<K,V> |
getAll(Collection<K> keys)
Gets entries from cache on remote grid.
|
<K,V> GridClientFuture<Map<K,V>> |
getAllAsync(Collection<K> keys)
Asynchronously gets entries from cache on remote grid.
|
<K,V> GridClientFuture<V> |
getAsync(K key)
Asynchronously gets value from cache on remote grid.
|
GridClientDataMetrics |
metrics()
Fetches metrics for cache from remote grid.
|
GridClientFuture<GridClientDataMetrics> |
metricsAsync()
Asynchronously fetches metrics for cache from remote grid.
|
Collection<GridClientNode> |
pinnedNodes()
Gets pinned node or
null if no nodes were pinned. |
GridClientData |
pinNodes(GridClientNode node,
GridClientNode... nodes)
Gets client data projection which will only contact specified remote grid node.
|
<K,V> boolean |
prepend(K key,
V val)
Prepend requested value to already cached one.
|
<K,V> GridClientFuture<Boolean> |
prependAsync(K key,
V val)
Prepend requested value to already cached one.
|
<K,V> boolean |
put(K key,
V val)
Puts value to cache on remote grid.
|
<K,V> void |
putAll(Map<K,V> entries)
Puts entries to cache on remote grid.
|
<K,V> GridClientFuture<?> |
putAllAsync(Map<K,V> entries)
Asynchronously puts entries to cache on remote grid.
|
<K,V> GridClientFuture<Boolean> |
putAsync(K key,
V val)
Asynchronously puts value to cache on remote node.
|
<K> boolean |
remove(K key)
Removes value from cache on remote node.
|
<K> void |
removeAll(Collection<K> keys)
Removes entries from cache on remote node.
|
<K> GridClientFuture<?> |
removeAllAsync(Collection<K> keys)
Asynchronously removes entries from cache on remote grid.
|
<K> GridClientFuture<Boolean> |
removeAsync(K key)
Asynchronously removes value from cache on remote grid.
|
<K,V> boolean |
replace(K key,
V val)
Replaces value in cache on remote grid only if there was a
non-null
value associated with this key. |
<K,V> GridClientFuture<Boolean> |
replaceAsync(K key,
V val)
Asynchronously replaces value in cache on remote grid only if there was a
non-null
value associated with this key. |
String cacheName()
GridClient.data(String)
method at the time of creation.GridClientData pinNodes(GridClientNode node, GridClientNode... nodes) throws GridClientException
GridClientDataAffinity
provided - this method allows
to override default behavior and use only specified server for all cache operations.
Use this method when there are other than key-affinity
reasons why a certain
node should be contacted.
node
- Node to be contacted (optional).nodes
- Additional nodes (optional).GridClientException
- If resulting projection is empty.Collection<GridClientNode> pinnedNodes()
null
if no nodes were pinned.<K,V> boolean put(K key, V val) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to put in cache.val
- Value to put in cache.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<Boolean> putAsync(K key, V val)
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to put in cache.val
- Value to put in cache.<K,V> void putAll(Map<K,V> entries) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
entries
- Entries to put in cache.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<?> putAllAsync(Map<K,V> entries)
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
entries
- Entries to put in cache.<K,V> V get(K key) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to get from cache.null
if no value was cached.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<V> getAsync(K key)
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to get from cache.null
if no value was cached.<K,V> Map<K,V> getAll(Collection<K> keys) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
keys
- Keys to get.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<Map<K,V>> getAllAsync(Collection<K> keys)
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
keys
- Keys to get.<K> boolean remove(K key) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to remove.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K> GridClientFuture<Boolean> removeAsync(K key)
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to remove.<K> void removeAll(Collection<K> keys) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
keys
- Keys to remove.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K> GridClientFuture<?> removeAllAsync(Collection<K> keys)
Note that this operation is affinity-aware and will immediately contact
exactly the remote nodes on which these keys are supposed to be cached (unless
some nodes were pinned
). If entries do not map to one node, then the node
which has most mapped entries will be contacted.
keys
- Keys to remove.<K,V> boolean replace(K key, V val) throws GridClientException
non-null
value associated with this key.
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to replace.val
- Value to replace.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<Boolean> replaceAsync(K key, V val)
non-null
value associated with this key.
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to replace.val
- Value to replace.<K,V> boolean cas(K key, V val1, V val2) throws GridClientException
val1
if current value is val2
with
following conditions:
val1
is null
and val2
is equal to current value,
entry is removed from cache.
val2
is null
, entry is created if it doesn't exist.
val1
and val2
are null
, entry is removed.
pinned
).key
- Key to set.val1
- Value to set.val2
- Check value.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> GridClientFuture<Boolean> casAsync(K key, V val1, V val2)
val1
if current value is val2
with following conditions:
val1
is null
and val2
is equal to current value,
entry is removed from cache.
val2
is null
, entry is created if it doesn't exist.
val1
and val2
are null
, entry is removed.
pinned
).key
- Key to set.val1
- Value to set.val2
- Check value.<K> UUID affinity(K key) throws GridClientException
null
if no
affinity was configured for the given cache for this client or there are no nodes in topology with
cache enabled.key
- Key.GridClientException
- In case of error.GridClientDataMetrics metrics() throws GridClientException
GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.GridClientFuture<GridClientDataMetrics> metricsAsync()
GridClientDataMetrics cachedMetrics() throws GridClientException
Local cache is updated on every metrics()
or metricsAsync()
call
if GridClientConfiguration.isEnableMetricsCache()
is enabled. If it is
disabled then this method will always return null
.
null
if no cached metrics available.GridClientException
- In case of error.GridServerUnreachableException
- If none of the servers can be reached.GridClientClosedException
- If client was closed manually.<K,V> boolean append(K key, V val) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to manipulate cache value for.val
- Value to append to the cached one.GridClientException
- In case of error.<K,V> GridClientFuture<Boolean> appendAsync(K key, V val) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to manipulate cache value for.val
- Value to append to the cached one.GridClientException
- In case of error.<K,V> boolean prepend(K key, V val) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to manipulate cache value for.val
- Value to prepend to the cached one.GridClientException
- In case of error.<K,V> GridClientFuture<Boolean> prependAsync(K key, V val) throws GridClientException
Note that this operation is affinity-aware and will immediately contact
exactly the remote node on which this key is supposed to be cached (unless
some nodes were pinned
).
key
- Key to manipulate cache value for.val
- Value to prepend to the cached one.GridClientException
- In case of error.Set<GridClientCacheFlag> flags()
GridClientData flagsOn(GridClientCacheFlag... flags) throws GridClientException
flags
- Optional cache flags to be enabled.GridClientException
- In case of error.GridClientData flagsOff(GridClientCacheFlag... flags) throws GridClientException
flags
- Cache flags to be disabled.GridClientException
- In case of error.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017