public interface MemcacheClient<V> extends ObservableClient
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<MemcacheStatus> |
add(java.lang.String key,
V value,
int ttl)
Add a key in memcache with the provided value, with the specified TTL.
|
default java.util.concurrent.CompletionStage<MemcacheStatus> |
add(java.lang.String key,
V value,
int ttl,
int flags)
Add a key in memcache with the provided value, with the specified TTL.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
append(java.lang.String key,
V value) |
java.util.concurrent.CompletionStage<java.util.List<GetResult<V>>> |
casGet(java.util.List<java.lang.String> keys)
Get the value for the provided keys
|
java.util.concurrent.CompletionStage<GetResult<V>> |
casGet(java.lang.String key)
Get the value for the provided key, including the CAS value and flags
|
default java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,GetResult<V>>> |
casGetAsMap(java.util.List<java.lang.String> keys)
Get the value for the provided keys
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
delete(java.lang.String key)
Delete the provided key
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
delete(java.lang.String key,
long cas)
Deletes a key with CAS check.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
deleteAll(java.lang.String key)
Delete the provided key on all memcached instances.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
flushAll(int delay)
Flushes all entries in the storage
|
java.util.concurrent.CompletionStage<java.util.List<V>> |
get(java.util.List<java.lang.String> keys)
Get the value for the provided keys
|
java.util.concurrent.CompletionStage<V> |
get(java.lang.String key)
Get the value for the provided key
|
default java.util.Map<java.lang.String,? extends MemcacheClient<V>> |
getAllNodes()
Returns a snapshot of the individual nodes that are part of the cluster right now.
|
default java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,V>> |
getAsMap(java.util.List<java.lang.String> keys)
Get the value for the provided keys
|
RawMemcacheClient |
getRawMemcacheClient()
Note: This is typically only useful for testing and debugging
|
java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,MemcachedStats>> |
getStats(java.lang.String key)
Get raw statistics from the memcached instances.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
prepend(java.lang.String key,
V value) |
java.util.concurrent.CompletionStage<MemcacheStatus> |
replace(java.lang.String key,
V value,
int ttl)
Replace a key in memcache with the provided value, with the specified TTL.
|
default java.util.concurrent.CompletionStage<MemcacheStatus> |
replace(java.lang.String key,
V value,
int ttl,
int flags)
Replace a key in memcache with the provided value, with the specified TTL.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
set(java.lang.String key,
V value,
int ttl)
Set a key in memcache to the provided value, with the specified TTL
|
default java.util.concurrent.CompletionStage<MemcacheStatus> |
set(java.lang.String key,
V value,
int ttl,
int flags)
Set a key in memcache to the provided value, with the specified TTL
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
set(java.lang.String key,
V value,
int ttl,
long cas)
Compare and set a key in memcache to the provided value, with the specified TTL
|
default java.util.concurrent.CompletionStage<MemcacheStatus> |
set(java.lang.String key,
V value,
int ttl,
long cas,
int flags)
Compare and set a key in memcache to the provided value, with the specified TTL
|
void |
shutdown()
Shut down the client.
|
java.util.concurrent.CompletionStage<MemcacheStatus> |
touch(java.lang.String key,
int ttl)
Sets the expiration for the provided key
|
awaitConnected, awaitDisconnected, awaitFullyConnected, awaitFullyDisconnected, awaitFuture, connectFuture, disconnectFuture, fullyConnectedFuture, fullyDisconnectFuture, getConnectionFailure, isConnected, notifyConnectionChange, numActiveConnections, numTotalConnections, registerForConnectionChanges, unregisterForConnectionChangesjava.util.concurrent.CompletionStage<MemcacheStatus> set(java.lang.String key, V value, int ttl)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondsdefault java.util.concurrent.CompletionStage<MemcacheStatus> set(java.lang.String key, V value, int ttl, int flags)
key - The key, must not be nullvalue - The value, must not be nullflags - Memcached flagsjava.util.concurrent.CompletionStage<MemcacheStatus> set(java.lang.String key, V value, int ttl, long cas)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondscas - The CAS value, must match the value on the server for the set to go throughdefault java.util.concurrent.CompletionStage<MemcacheStatus> set(java.lang.String key, V value, int ttl, long cas, int flags)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondscas - The CAS value, must match the value on the server for the set to go throughflags - Memcached flagsjava.util.concurrent.CompletionStage<MemcacheStatus> delete(java.lang.String key)
key - Key, must not be nulljava.util.concurrent.CompletionStage<MemcacheStatus> delete(java.lang.String key, long cas)
key - The key, must not be nullcas - The CAS value, must match the value on the server for the set to go throughjava.util.concurrent.CompletionStage<MemcacheStatus> deleteAll(java.lang.String key)
key - Key, must not be nulljava.util.concurrent.CompletionStage<MemcacheStatus> add(java.lang.String key, V value, int ttl)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondsdefault java.util.concurrent.CompletionStage<MemcacheStatus> add(java.lang.String key, V value, int ttl, int flags)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondsflags - Memcached flagsjava.util.concurrent.CompletionStage<MemcacheStatus> replace(java.lang.String key, V value, int ttl)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondsdefault java.util.concurrent.CompletionStage<MemcacheStatus> replace(java.lang.String key, V value, int ttl, int flags)
key - The key, must not be nullvalue - The value, must not be nullttl - The TTL in secondsflags - Memcached flagsjava.util.concurrent.CompletionStage<MemcacheStatus> append(java.lang.String key, V value)
java.util.concurrent.CompletionStage<MemcacheStatus> prepend(java.lang.String key, V value)
java.util.concurrent.CompletionStage<V> get(java.lang.String key)
key - The key, must not be nulljava.util.concurrent.CompletionStage<GetResult<V>> casGet(java.lang.String key)
key - First key, must not be nulljava.util.concurrent.CompletionStage<java.util.List<V>> get(java.util.List<java.lang.String> keys)
keys - Keys, must not be null, nor must any key in the listdefault java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,V>> getAsMap(java.util.List<java.lang.String> keys)
keys - Keys, must not be null, nor must any key in the listjava.util.concurrent.CompletionStage<java.util.List<GetResult<V>>> casGet(java.util.List<java.lang.String> keys)
keys - Keys, must not be null, nor must any key in the listdefault java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,GetResult<V>>> casGetAsMap(java.util.List<java.lang.String> keys)
keys - Keys, must not be null, nor must any key in the listjava.util.concurrent.CompletionStage<MemcacheStatus> touch(java.lang.String key, int ttl)
key - First key, must not be nullttl - The TTL in secondsjava.util.concurrent.CompletionStage<MemcacheStatus> flushAll(int delay)
delay - The flush delay in seconds.java.util.concurrent.CompletionStage<java.util.Map<java.lang.String,MemcachedStats>> getStats(java.lang.String key)
The reason for including potentially multiple statistics containers is to support the ketama use-case where there may be multiple memcached instances.
If any of the instances fail to return statistics, the exception will be propagated.
Valid keys are:
key - - statistics key.void shutdown()
RawMemcacheClient getRawMemcacheClient()
default java.util.Map<java.lang.String,? extends MemcacheClient<V>> getAllNodes()
The keys of the map are in the format "host:port" and the values are regular memcached clients.
Note that changes to the topology will not be reflected this snapshot. The snapshot should be considered short-lived.
The clients from the snapshot should not be closed after use since they are references to the actual clients in the cluster.
Copyright © 2023 Spotify AB. All Rights Reserved.