public class MemcachedClient extends SpyObject implements MemcachedClientIF, ConnectionObserver
The Client can be run in static mode or dynamic mode. In basic usage the mode is automatically
determined based on the endpoint specified. If the endpoint has cfg subdomain, then the client is
initialized in dynamic mode.
// Use dynamic mode to leverage Elasticache Autodiscovery feature.
// In dynamic mode, the number of servers in the cluster and their endpoint details are automatically picked up
// using the configuration endpoint of the elasticache cluster.
MemcachedClient c = new MemcachedClient(
new InetSocketAddress("configurationEndpoint", portNum));
// Store a value (async) for one hour
c.set("someKey", 3600, someObject);
// Retrieve a value.
Object myObject = c.get("someKey");
In the basic usage with out connection factory, the client mode is automatically determined
MemcachedClient may be processing a great deal of asynchronous messages or possibly dealing with an unreachable memcached, which may delay processing. If a memcached is disabled, for example, MemcachedConnection will continue to attempt to reconnect and replay pending operations until it comes back up. To prevent this from causing your application to hang, you can use one of the asynchronous mechanisms to time out a request and cancel the operation to the server.
// Get a memcached client connected over the binary protocol
// The number of servers in the cluster and their endpoint details are automatically picked up
// using the configuration endpoint of the elasticache cluster.
MemcachedClient c = new MemcachedClient(new BinaryConnectionFactory(ClientMode.Dynamic),
AddrUtil.getAddresses("configurationEndpoint:11211"));
// or //
// For operating with out the autodiscovery feature, use static mode(ClientMode.Static)
MemcachedClient c = new MemcachedClient(new BinaryConnectionFactory(ClientMode.Static),
AddrUtil.getAddresses("configurationEndpoint:11211"));
// Try to get a value, for up to 5 seconds, and cancel if it
// doesn't return
Object myObj = null;
Future<Object> f = c.asyncGet("someKey");
try {
myObj = f.get(5, TimeUnit.SECONDS);
// throws expecting InterruptedException, ExecutionException
// or TimeoutException
} catch (Exception e) { /* /
// Since we don't need this, go ahead and cancel the operation.
// This is not strictly necessary, but it'll save some work on
// the server. It is okay to cancel it if running.
f.cancel(true);
// Do other timeout related stuff
}
Optionally, it is possible to activate a check that makes sure that the node is alive and responding before running actual operations (even before authentication. Only enable this if you are sure that you do not run into issues during connection (some memcached services have problems with it). You can enable it by setting the net.spy.verifyAliveOnConnect System Property to "true".
| Modifier and Type | Field and Description |
|---|---|
protected AuthDescriptor |
authDescriptor |
protected AuthThreadMonitor |
authMonitor |
protected ClientMode |
clientMode |
protected ConnectionFactory |
connFactory |
protected java.util.concurrent.ExecutorService |
executorService |
protected MemcachedConnection |
mconn |
protected long |
operationTimeout |
protected OperationFactory |
opFact |
protected boolean |
shuttingDown |
protected TranscodeService |
tcService |
protected Transcoder<java.lang.Object> |
transcoder |
MAX_KEY_LENGTH| Constructor and Description |
|---|
MemcachedClient(ConnectionFactory cf,
java.util.List<java.net.InetSocketAddress> addrs) |
MemcachedClient(java.net.InetSocketAddress... addrs)
Get a memcache client operating on the specified memcached locations.
|
MemcachedClient(java.util.List<java.net.InetSocketAddress> addrs)
Get a memcache client over the specified memcached locations.
|
| Modifier and Type | Method and Description |
|---|---|
OperationFuture<java.lang.Boolean> |
add(java.lang.String key,
int exp,
java.lang.Object o)
Add an object to the cache (using the default transcoder) iff it does not
exist already.
|
<T> OperationFuture<java.lang.Boolean> |
add(java.lang.String key,
int exp,
T o,
Transcoder<T> tc)
Add an object to the cache iff it does not exist already.
|
boolean |
addObserver(ConnectionObserver obs)
Add a connection observer.
|
OperationFuture<java.lang.Boolean> |
append(long cas,
java.lang.String key,
java.lang.Object val)
Append to an existing value in the cache.
|
<T> OperationFuture<java.lang.Boolean> |
append(long cas,
java.lang.String key,
T val,
Transcoder<T> tc)
Append to an existing value in the cache.
|
OperationFuture<java.lang.Boolean> |
append(java.lang.String key,
java.lang.Object val)
Append to an existing value in the cache.
|
<T> OperationFuture<java.lang.Boolean> |
append(java.lang.String key,
T val,
Transcoder<T> tc)
Append to an existing value in the cache.
|
OperationFuture<CASResponse> |
asyncCAS(java.lang.String key,
long casId,
int exp,
java.lang.Object value)
Asynchronous CAS operation using the default transcoder with expiration.
|
<T> OperationFuture<CASResponse> |
asyncCAS(java.lang.String key,
long casId,
int exp,
T value,
Transcoder<T> tc)
Asynchronous CAS operation.
|
OperationFuture<CASResponse> |
asyncCAS(java.lang.String key,
long casId,
java.lang.Object value)
Asynchronous CAS operation using the default transcoder.
|
<T> OperationFuture<CASResponse> |
asyncCAS(java.lang.String key,
long casId,
T value,
Transcoder<T> tc)
Asynchronous CAS operation.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
int by)
Asynchronous decrement.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
int by,
long def)
Asynchronous decrement.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
int by,
long def,
int exp)
Asynchronous decrement.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
long by)
Asynchronous decrement.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
long by,
long def)
Asynchronous decrement.
|
OperationFuture<java.lang.Long> |
asyncDecr(java.lang.String key,
long by,
long def,
int exp)
Asynchronous decrement.
|
GetFuture<java.lang.Object> |
asyncGet(java.lang.String key)
Get the given key asynchronously and decode with the default transcoder.
|
<T> GetFuture<T> |
asyncGet(java.lang.String key,
Transcoder<T> tc)
Get the given key asynchronously.
|
OperationFuture<CASValue<java.lang.Object>> |
asyncGetAndTouch(java.lang.String key,
int exp)
Get the given key to reset its expiration time.
|
<T> OperationFuture<CASValue<T>> |
asyncGetAndTouch(java.lang.String key,
int exp,
Transcoder<T> tc)
Get the given key to reset its expiration time.
|
BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> |
asyncGetBulk(java.util.Collection<java.lang.String> keys)
Asynchronously get a bunch of objects from the cache and decode them with
the given transcoder.
|
<T> BulkFuture<java.util.Map<java.lang.String,T>> |
asyncGetBulk(java.util.Collection<java.lang.String> keys,
java.util.Iterator<Transcoder<T>> tcIter)
Asynchronously get a bunch of objects from the cache.
|
<T> BulkFuture<java.util.Map<java.lang.String,T>> |
asyncGetBulk(java.util.Collection<java.lang.String> keys,
Transcoder<T> tc)
Asynchronously get a bunch of objects from the cache.
|
BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> |
asyncGetBulk(java.util.Iterator<java.lang.String> keyIter)
Asynchronously get a bunch of objects from the cache and decode them with
the given transcoder.
|
<T> BulkFuture<java.util.Map<java.lang.String,T>> |
asyncGetBulk(java.util.Iterator<java.lang.String> keyIter,
java.util.Iterator<Transcoder<T>> tcIter)
Asynchronously get a bunch of objects from the cache.
|
<T> BulkFuture<java.util.Map<java.lang.String,T>> |
asyncGetBulk(java.util.Iterator<java.lang.String> keyIter,
Transcoder<T> tc)
Asynchronously get a bunch of objects from the cache.
|
BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> |
asyncGetBulk(java.lang.String... keys)
Varargs wrapper for asynchronous bulk gets with the default transcoder.
|
<T> BulkFuture<java.util.Map<java.lang.String,T>> |
asyncGetBulk(Transcoder<T> tc,
java.lang.String... keys)
Varargs wrapper for asynchronous bulk gets.
|
<T> GetConfigFuture<T> |
asyncGetConfig(java.net.InetSocketAddress addr,
ConfigurationType type,
Transcoder<T> tc)
Get the given configurationType asynchronously.
|
OperationFuture<CASValue<java.lang.Object>> |
asyncGets(java.lang.String key)
Gets (with CAS support) the given key asynchronously and decode using the
default transcoder.
|
<T> OperationFuture<CASValue<T>> |
asyncGets(java.lang.String key,
Transcoder<T> tc)
Gets (with CAS support) the given key asynchronously.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
int by)
Asychronous increment.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
int by,
long def)
Asychronous increment.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
int by,
long def,
int exp)
Asychronous increment.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
long by)
Asychronous increment.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
long by,
long def)
Asychronous increment.
|
OperationFuture<java.lang.Long> |
asyncIncr(java.lang.String key,
long by,
long def,
int exp)
Asychronous increment.
|
java.util.concurrent.CountDownLatch |
broadcastOp(BroadcastOpFactory of) |
java.util.concurrent.CountDownLatch |
broadcastOp(BroadcastOpFactory of,
java.util.Collection<MemcachedNode> nodes) |
CASResponse |
cas(java.lang.String key,
long casId,
int exp,
java.lang.Object value)
Perform a synchronous CAS operation with the default transcoder.
|
<T> CASResponse |
cas(java.lang.String key,
long casId,
int exp,
T value,
Transcoder<T> tc)
Perform a synchronous CAS operation.
|
CASResponse |
cas(java.lang.String key,
long casId,
java.lang.Object value)
Perform a synchronous CAS operation with the default transcoder.
|
<T> CASResponse |
cas(java.lang.String key,
long casId,
T value,
Transcoder<T> tc)
Perform a synchronous CAS operation.
|
void |
connectionEstablished(java.net.SocketAddress sa,
int reconnectCount)
A connection has just successfully been established on the given socket.
|
void |
connectionLost(java.net.SocketAddress sa)
A connection was just lost on the given socket.
|
long |
decr(java.lang.String key,
int by)
Decrement the given key by the given value.
|
long |
decr(java.lang.String key,
int by,
long def)
Decrement the given counter, returning the new value.
|
long |
decr(java.lang.String key,
int by,
long def,
int exp)
Decrement the given counter, returning the new value.
|
long |
decr(java.lang.String key,
long by)
Decrement the given key by the given value.
|
long |
decr(java.lang.String key,
long by,
long def)
Decrement the given counter, returning the new value.
|
long |
decr(java.lang.String key,
long by,
long def,
int exp)
Decrement the given counter, returning the new value.
|
OperationFuture<java.lang.Boolean> |
delete(java.lang.String key)
Delete the given key from the cache.
|
OperationFuture<java.lang.Boolean> |
delete(java.lang.String key,
int hold)
Deprecated.
Hold values are no longer honored.
|
OperationFuture<java.lang.Boolean> |
delete(java.lang.String key,
long cas)
Delete the given key from the cache of the given CAS value applies.
|
OperationFuture<java.lang.Boolean> |
deleteConfig(java.net.InetSocketAddress addr,
ConfigurationType configurationType)
Delete the given configurationType from the cache server.
|
OperationFuture<java.lang.Boolean> |
flush()
Flush all caches from all servers immediately.
|
OperationFuture<java.lang.Boolean> |
flush(int delay)
Flush all caches from all servers with a delay of application.
|
java.lang.Object |
get(java.lang.String key)
Get with a single key and decode using the default transcoder.
|
<T> T |
get(java.lang.String key,
Transcoder<T> tc)
Get with a single key.
|
java.util.Collection<NodeEndPoint> |
getAllNodeEndPoints()
Get the endpoints of all servers.
|
CASValue<java.lang.Object> |
getAndTouch(java.lang.String key,
int exp)
Get a single key and reset its expiration using the default transcoder.
|
<T> CASValue<T> |
getAndTouch(java.lang.String key,
int exp,
Transcoder<T> tc)
Get with a single key and reset its expiration.
|
java.util.Collection<NodeEndPoint> |
getAvailableNodeEndPoints()
Get the endpoints of available servers.
|
java.util.Collection<java.net.SocketAddress> |
getAvailableServers()
Get the addresses of available servers.
|
java.util.Map<java.lang.String,java.lang.Object> |
getBulk(java.util.Collection<java.lang.String> keys)
Get the values for multiple keys from the cache.
|
<T> java.util.Map<java.lang.String,T> |
getBulk(java.util.Collection<java.lang.String> keys,
Transcoder<T> tc)
Get the values for multiple keys from the cache.
|
java.util.Map<java.lang.String,java.lang.Object> |
getBulk(java.util.Iterator<java.lang.String> keyIter)
Get the values for multiple keys from the cache.
|
<T> java.util.Map<java.lang.String,T> |
getBulk(java.util.Iterator<java.lang.String> keyIter,
Transcoder<T> tc)
Get the values for multiple keys from the cache.
|
java.util.Map<java.lang.String,java.lang.Object> |
getBulk(java.lang.String... keys)
Get the values for multiple keys from the cache.
|
<T> java.util.Map<java.lang.String,T> |
getBulk(Transcoder<T> tc,
java.lang.String... keys)
Get the values for multiple keys from the cache.
|
java.lang.Object |
getConfig(java.net.InetSocketAddress addr,
ConfigurationType type)
Get the config
|
<T> T |
getConfig(java.net.InetSocketAddress addr,
ConfigurationType type,
Transcoder<T> tc)
Get the config using the config protocol.
|
NodeEndPoint |
getConfigurationNode() |
MemcachedConnection |
getConnection() |
java.util.concurrent.ExecutorService |
getExecutorService() |
NodeLocator |
getNodeLocator()
Get a read-only wrapper around the node locator wrapping this instance.
|
long |
getOperationTimeout() |
CASValue<java.lang.Object> |
gets(java.lang.String key)
Gets (with CAS support) with a single key using the default transcoder.
|
<T> CASValue<T> |
gets(java.lang.String key,
Transcoder<T> tc)
Gets (with CAS support) with a single key.
|
java.util.Map<java.net.SocketAddress,java.util.Map<java.lang.String,java.lang.String>> |
getStats()
Get all of the stats from all of the connections.
|
java.util.Map<java.net.SocketAddress,java.util.Map<java.lang.String,java.lang.String>> |
getStats(java.lang.String arg)
Get a set of stats from all connections.
|
Transcoder<java.lang.Object> |
getTranscoder()
Get the default transcoder that's in use.
|
TranscodeService |
getTranscoderService() |
java.util.Collection<java.net.SocketAddress> |
getUnavailableServers()
Get the addresses of unavailable servers.
|
java.util.Map<java.net.SocketAddress,java.lang.String> |
getVersions()
Get the versions of all of the connected memcacheds.
|
long |
incr(java.lang.String key,
int by)
Increment the given key by the given amount.
|
long |
incr(java.lang.String key,
int by,
long def)
Increment the given counter, returning the new value.
|
long |
incr(java.lang.String key,
int by,
long def,
int exp)
Increment the given counter, returning the new value.
|
long |
incr(java.lang.String key,
long by)
Increment the given key by the given amount.
|
long |
incr(java.lang.String key,
long by,
long def)
Increment the given counter, returning the new value.
|
long |
incr(java.lang.String key,
long by,
long def,
int exp)
Increment the given counter, returning the new value.
|
boolean |
isConfigurationInitialized() |
boolean |
isConfigurationProtocolSupported() |
java.util.Set<java.lang.String> |
listSaslMechanisms()
Get the set of SASL mechanisms supported by the servers.
|
OperationFuture<java.lang.Boolean> |
prepend(long cas,
java.lang.String key,
java.lang.Object val)
Prepend to an existing value in the cache.
|
<T> OperationFuture<java.lang.Boolean> |
prepend(long cas,
java.lang.String key,
T val,
Transcoder<T> tc)
Prepend to an existing value in the cache.
|
OperationFuture<java.lang.Boolean> |
prepend(java.lang.String key,
java.lang.Object val)
Prepend to an existing value in the cache.
|
<T> OperationFuture<java.lang.Boolean> |
prepend(java.lang.String key,
T val,
Transcoder<T> tc)
Prepend to an existing value in the cache.
|
boolean |
refreshCertificate()
Refresh the TLS certificate on all memcached nodes for the current client
|
boolean |
removeObserver(ConnectionObserver obs)
Remove a connection observer.
|
OperationFuture<java.lang.Boolean> |
replace(java.lang.String key,
int exp,
java.lang.Object o)
Replace an object with the given value (transcoded with the default
transcoder) iff there is already a value for the given key.
|
<T> OperationFuture<java.lang.Boolean> |
replace(java.lang.String key,
int exp,
T o,
Transcoder<T> tc)
Replace an object with the given value iff there is already a value for the
given key.
|
OperationFuture<java.lang.Boolean> |
set(java.lang.String key,
int exp,
java.lang.Object o)
Set an object in the cache (using the default transcoder) regardless of any
existing value.
|
<T> OperationFuture<java.lang.Boolean> |
set(java.lang.String key,
int exp,
T o,
Transcoder<T> tc)
Set an object in the cache regardless of any existing value.
|
OperationFuture<java.lang.Boolean> |
setConfig(java.net.InetSocketAddress addr,
ConfigurationType configurationType,
java.lang.Object o)
Sets the configuration in the cache node for the specified configurationType.
|
<T> OperationFuture<java.lang.Boolean> |
setConfig(java.net.InetSocketAddress addr,
ConfigurationType configurationType,
java.lang.Object o,
Transcoder<T> tc)
Sets the configuration in the cache node for the specified configurationType.
|
void |
shutdown()
Shut down immediately.
|
boolean |
shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Shut down this client gracefully.
|
java.lang.String |
toString() |
<T> OperationFuture<java.lang.Boolean> |
touch(java.lang.String key,
int exp)
Touch the given key to reset its expiration time with the default
transcoder.
|
<T> OperationFuture<java.lang.Boolean> |
touch(java.lang.String key,
int exp,
Transcoder<T> tc)
Touch the given key to reset its expiration time.
|
boolean |
waitForQueues(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the queues to die down.
|
protected final ClientMode clientMode
protected volatile boolean shuttingDown
protected final long operationTimeout
protected MemcachedConnection mconn
protected final OperationFactory opFact
protected final Transcoder<java.lang.Object> transcoder
protected final TranscodeService tcService
protected final AuthDescriptor authDescriptor
protected final ConnectionFactory connFactory
protected final AuthThreadMonitor authMonitor
protected final java.util.concurrent.ExecutorService executorService
public MemcachedClient(java.net.InetSocketAddress... addrs)
throws java.io.IOException
addrs - the memcached locationsjava.io.IOExceptionpublic MemcachedClient(java.util.List<java.net.InetSocketAddress> addrs)
throws java.io.IOException
addrs - the socket addrsjava.io.IOException - if connections cannot be establishedpublic MemcachedClient(ConnectionFactory cf, java.util.List<java.net.InetSocketAddress> addrs) throws java.io.IOException
java.io.IOExceptionpublic NodeEndPoint getConfigurationNode()
public java.util.Collection<java.net.SocketAddress> getAvailableServers()
This is based on a snapshot in time so shouldn't be considered completely accurate, but is a useful for getting a feel for what's working and what's not working.
getAvailableServers in interface MemcachedClientIFpublic java.util.Collection<NodeEndPoint> getAvailableNodeEndPoints()
This is based on a snapshot in time so shouldn't be considered completely accurate, but is a useful for getting a feel for what's working and what's not working.
public java.util.Collection<NodeEndPoint> getAllNodeEndPoints()
public java.util.Collection<java.net.SocketAddress> getUnavailableServers()
This is based on a snapshot in time so shouldn't be considered completely accurate, but is a useful for getting a feel for what's working and what's not working.
getUnavailableServers in interface MemcachedClientIFpublic NodeLocator getNodeLocator()
getNodeLocator in interface MemcachedClientIFpublic Transcoder<java.lang.Object> getTranscoder()
getTranscoder in interface MemcachedClientIFpublic java.util.concurrent.CountDownLatch broadcastOp(BroadcastOpFactory of)
broadcastOp in interface MemcachedClientIFpublic java.util.concurrent.CountDownLatch broadcastOp(BroadcastOpFactory of, java.util.Collection<MemcachedNode> nodes)
broadcastOp in interface MemcachedClientIFpublic <T> OperationFuture<java.lang.Boolean> touch(java.lang.String key, int exp)
touch in interface MemcachedClientIFkey - the key to fetchexp - the new expiration to set for the given keyjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> touch(java.lang.String key, int exp, Transcoder<T> tc)
touch in interface MemcachedClientIFkey - the key to fetchexp - the new expiration to set for the given keytc - the transcoder to serialize and unserialize valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> append(long cas, java.lang.String key, java.lang.Object val)
Note that the return will be false any time a mutation has not occurred.
append in interface MemcachedClientIFcas - cas identifier (ignored in the ascii protocol)key - the key to whose value will be appendedval - the value to appendjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> append(java.lang.String key, java.lang.Object val)
Note that the return will be false any time a mutation has not occurred.
append in interface MemcachedClientIFkey - the key to whose value will be appendedval - the value to appendjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> append(long cas, java.lang.String key, T val, Transcoder<T> tc)
Note that the return will be false any time a mutation has not occurred.
append in interface MemcachedClientIFT - cas - cas identifier (ignored in the ascii protocol)key - the key to whose value will be appendedval - the value to appendtc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> append(java.lang.String key, T val, Transcoder<T> tc)
Note that the return will be false any time a mutation has not occurred.
append in interface MemcachedClientIFT - key - the key to whose value will be appendedval - the value to appendtc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> prepend(long cas, java.lang.String key, java.lang.Object val)
Note that the return will be false any time a mutation has not occurred.
prepend in interface MemcachedClientIFcas - cas identifier (ignored in the ascii protocol)key - the key to whose value will be prependedval - the value to appendjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> prepend(java.lang.String key, java.lang.Object val)
Note that the return will be false any time a mutation has not occurred.
prepend in interface MemcachedClientIFkey - the key to whose value will be prependedval - the value to appendjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> prepend(long cas, java.lang.String key, T val, Transcoder<T> tc)
Note that the return will be false any time a mutation has not occurred.
prepend in interface MemcachedClientIFT - cas - cas identifier (ignored in the ascii protocol)key - the key to whose value will be prependedval - the value to appendtc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> prepend(java.lang.String key, T val, Transcoder<T> tc)
Note that the return will be false any time a mutation has not occurred.
prepend in interface MemcachedClientIFT - key - the key to whose value will be prependedval - the value to appendtc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<CASResponse> asyncCAS(java.lang.String key, long casId, T value, Transcoder<T> tc)
asyncCAS in interface MemcachedClientIFT - key - the keycasId - the CAS identifier (from a gets operation)value - the new valuetc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<CASResponse> asyncCAS(java.lang.String key, long casId, int exp, T value, Transcoder<T> tc)
asyncCAS in interface MemcachedClientIFT - key - the keycasId - the CAS identifier (from a gets operation)exp - the expiration of this objectvalue - the new valuetc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<CASResponse> asyncCAS(java.lang.String key, long casId, java.lang.Object value)
asyncCAS in interface MemcachedClientIFkey - the keycasId - the CAS identifier (from a gets operation)value - the new valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<CASResponse> asyncCAS(java.lang.String key, long casId, int exp, java.lang.Object value)
asyncCAS in interface MemcachedClientIFkey - the keycasId - the CAS identifier (from a gets operation)exp - the expiration of this objectvalue - the new valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> CASResponse cas(java.lang.String key, long casId, T value, Transcoder<T> tc)
cas in interface MemcachedClientIFT - key - the keycasId - the CAS identifier (from a gets operation)value - the new valuetc - the transcoder to serialize and unserialize the valueOperationTimeoutException - if global operation timeout is exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> CASResponse cas(java.lang.String key, long casId, int exp, T value, Transcoder<T> tc)
cas in interface MemcachedClientIFT - key - the keycasId - the CAS identifier (from a gets operation)exp - the expiration of this objectvalue - the new valuetc - the transcoder to serialize and unserialize the valueOperationTimeoutException - if global operation timeout is exceededjava.util.concurrent.CancellationException - if operation was canceledjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic CASResponse cas(java.lang.String key, long casId, java.lang.Object value)
cas in interface MemcachedClientIFkey - the keycasId - the CAS identifier (from a gets operation)value - the new valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic CASResponse cas(java.lang.String key, long casId, int exp, java.lang.Object value)
cas in interface MemcachedClientIFkey - the keycasId - the CAS identifier (from a gets operation)exp - the expiration of this objectvalue - the new valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> add(java.lang.String key, int exp, T o, Transcoder<T> tc)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
add in interface MemcachedClientIFT - key - the key under which this object should be added.exp - the expiration of this objecto - the object to storetc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> add(java.lang.String key, int exp, java.lang.Object o)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
add in interface MemcachedClientIFkey - the key under which this object should be added.exp - the expiration of this objecto - the object to storejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> set(java.lang.String key, int exp, T o, Transcoder<T> tc)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
set in interface MemcachedClientIFT - key - the key under which this object should be added.exp - the expiration of this objecto - the object to storetc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> set(java.lang.String key, int exp, java.lang.Object o)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
set in interface MemcachedClientIFkey - the key under which this object should be added.exp - the expiration of this objecto - the object to storejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> replace(java.lang.String key, int exp, T o, Transcoder<T> tc)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
replace in interface MemcachedClientIFT - key - the key under which this object should be added.exp - the expiration of this objecto - the object to storetc - the transcoder to serialize and unserialize the valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> replace(java.lang.String key, int exp, java.lang.Object o)
The exp value is passed along to memcached exactly as given,
and will be processed per the memcached protocol specification:
Note that the return will be false any time a mutation has not occurred.
The actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time.
replace in interface MemcachedClientIFkey - the key under which this object should be added.exp - the expiration of this objecto - the object to storejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> GetFuture<T> asyncGet(java.lang.String key, Transcoder<T> tc)
asyncGet in interface MemcachedClientIFT - key - the key to fetchtc - the transcoder to serialize and unserialize valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic GetFuture<java.lang.Object> asyncGet(java.lang.String key)
asyncGet in interface MemcachedClientIFkey - the key to fetchjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<CASValue<T>> asyncGets(java.lang.String key, Transcoder<T> tc)
asyncGets in interface MemcachedClientIFT - key - the key to fetchtc - the transcoder to serialize and unserialize valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<CASValue<java.lang.Object>> asyncGets(java.lang.String key)
asyncGets in interface MemcachedClientIFkey - the key to fetchjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> CASValue<T> gets(java.lang.String key, Transcoder<T> tc)
gets in interface MemcachedClientIFT - key - the key to gettc - the transcoder to serialize and unserialize valueOperationTimeoutException - if global operation timeout is exceededjava.util.concurrent.CancellationException - if operation was canceledjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> CASValue<T> getAndTouch(java.lang.String key, int exp, Transcoder<T> tc)
getAndTouch in interface MemcachedClientIFT - key - the key to getexp - the new expiration for the keytc - the transcoder to serialize and unserialize valueOperationTimeoutException - if the global operation timeout is
exceededjava.util.concurrent.CancellationException - if operation was canceledjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic CASValue<java.lang.Object> getAndTouch(java.lang.String key, int exp)
getAndTouch in interface MemcachedClientIFkey - the key to getexp - the new expiration for the keyOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic CASValue<java.lang.Object> gets(java.lang.String key)
gets in interface MemcachedClientIFkey - the key to getOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> T get(java.lang.String key,
Transcoder<T> tc)
get in interface MemcachedClientIFT - key - the key to gettc - the transcoder to serialize and unserialize valueOperationTimeoutException - if the global operation timeout is
exceededjava.util.concurrent.CancellationException - if operation was canceledjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.lang.Object get(java.lang.String key)
get in interface MemcachedClientIFkey - the key to getOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> BulkFuture<java.util.Map<java.lang.String,T>> asyncGetBulk(java.util.Iterator<java.lang.String> keyIter, java.util.Iterator<Transcoder<T>> tcIter)
asyncGetBulk in interface MemcachedClientIFT - keyIter - Iterator that produces keys.tcIter - an iterator of transcoders to serialize and unserialize
values; the transcoders are matched with the keys in the same
order. The minimum of the key collection length and number of
transcoders is used and no exception is thrown if they do not
matchjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> BulkFuture<java.util.Map<java.lang.String,T>> asyncGetBulk(java.util.Collection<java.lang.String> keys, java.util.Iterator<Transcoder<T>> tcIter)
asyncGetBulk in interface MemcachedClientIFT - keys - the keys to requesttcIter - an iterator of transcoders to serialize and unserialize
values; the transcoders are matched with the keys in the same
order. The minimum of the key collection length and number of
transcoders is used and no exception is thrown if they do not
matchjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> BulkFuture<java.util.Map<java.lang.String,T>> asyncGetBulk(java.util.Iterator<java.lang.String> keyIter, Transcoder<T> tc)
asyncGetBulk in interface MemcachedClientIFT - keyIter - Iterator for the keys to requesttc - the transcoder to serialize and unserialize valuesjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> BulkFuture<java.util.Map<java.lang.String,T>> asyncGetBulk(java.util.Collection<java.lang.String> keys, Transcoder<T> tc)
asyncGetBulk in interface MemcachedClientIFT - keys - the keys to requesttc - the transcoder to serialize and unserialize valuesjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> asyncGetBulk(java.util.Iterator<java.lang.String> keyIter)
asyncGetBulk in interface MemcachedClientIFkeyIter - Iterator that produces the keys to requestjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> asyncGetBulk(java.util.Collection<java.lang.String> keys)
asyncGetBulk in interface MemcachedClientIFkeys - the keys to requestjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> BulkFuture<java.util.Map<java.lang.String,T>> asyncGetBulk(Transcoder<T> tc, java.lang.String... keys)
asyncGetBulk in interface MemcachedClientIFT - tc - the transcoder to serialize and unserialize valuekeys - one more more keys to getjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic BulkFuture<java.util.Map<java.lang.String,java.lang.Object>> asyncGetBulk(java.lang.String... keys)
asyncGetBulk in interface MemcachedClientIFkeys - one more more keys to getjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<CASValue<java.lang.Object>> asyncGetAndTouch(java.lang.String key, int exp)
asyncGetAndTouch in interface MemcachedClientIFkey - the key to fetchexp - the new expiration to set for the given keyjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<CASValue<T>> asyncGetAndTouch(java.lang.String key, int exp, Transcoder<T> tc)
asyncGetAndTouch in interface MemcachedClientIFkey - the key to fetchexp - the new expiration to set for the given keytc - the transcoder to serialize and unserialize valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> java.util.Map<java.lang.String,T> getBulk(java.util.Iterator<java.lang.String> keyIter,
Transcoder<T> tc)
getBulk in interface MemcachedClientIFT - keyIter - Iterator that produces the keystc - the transcoder to serialize and unserialize valueOperationTimeoutException - if the global operation timeout is
exceededjava.util.concurrent.CancellationException - if operation was canceledjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.lang.String,java.lang.Object> getBulk(java.util.Iterator<java.lang.String> keyIter)
getBulk in interface MemcachedClientIFkeyIter - Iterator that produces the keysOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> java.util.Map<java.lang.String,T> getBulk(java.util.Collection<java.lang.String> keys,
Transcoder<T> tc)
getBulk in interface MemcachedClientIFT - keys - the keystc - the transcoder to serialize and unserialize valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.lang.String,java.lang.Object> getBulk(java.util.Collection<java.lang.String> keys)
getBulk in interface MemcachedClientIFkeys - the keysOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> java.util.Map<java.lang.String,T> getBulk(Transcoder<T> tc, java.lang.String... keys)
getBulk in interface MemcachedClientIFT - tc - the transcoder to serialize and unserialize valuekeys - the keysOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.lang.String,java.lang.Object> getBulk(java.lang.String... keys)
getBulk in interface MemcachedClientIFkeys - the keysOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.lang.Object getConfig(java.net.InetSocketAddress addr,
ConfigurationType type)
addr - - The node from which to retrieve the configurationtype - - config to getOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> T getConfig(java.net.InetSocketAddress addr,
ConfigurationType type,
Transcoder<T> tc)
addr - - The node from which to retrieve the configurationconfig - to gettc - the transcoder to serialize and unserialize valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> GetConfigFuture<T> asyncGetConfig(java.net.InetSocketAddress addr, ConfigurationType type, Transcoder<T> tc)
addr - - The node from which to retrieve the configurationconfigurationType - the configurationType to fetchtc - the transcoder to serialize and unserialize valuejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> setConfig(java.net.InetSocketAddress addr, ConfigurationType configurationType, java.lang.Object o)
addr - - The node where the configuration is set.type - the type under which this configuration should be added.o - the configuration to storejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic <T> OperationFuture<java.lang.Boolean> setConfig(java.net.InetSocketAddress addr, ConfigurationType configurationType, java.lang.Object o, Transcoder<T> tc)
addr - - The node where the configuration is set.type - the type under which this configuration should be added.o - the configuration to storetc - the transcoder to serialize and unserialize the configurationjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> deleteConfig(java.net.InetSocketAddress addr, ConfigurationType configurationType)
addr - - The node in which the configuration is deleted.configurationType - the configurationType to deletejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.net.SocketAddress,java.lang.String> getVersions()
getVersions in interface MemcachedClientIFjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.net.SocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStats()
getStats in interface MemcachedClientIFjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic java.util.Map<java.net.SocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStats(java.lang.String arg)
getStats in interface MemcachedClientIFarg - which stats to getjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
long by)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
int by)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
long by)
decr in interface MemcachedClientIFkey - the keyby - the valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
int by)
decr in interface MemcachedClientIFkey - the keyby - the valueOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
long by,
long def,
int exp)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementdef - the default value (if the counter does not exist)exp - the expiration of this objectOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
int by,
long def,
int exp)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementdef - the default value (if the counter does not exist)exp - the expiration of this objectOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
long by,
long def,
int exp)
decr in interface MemcachedClientIFkey - the keyby - the amount to decrementdef - the default value (if the counter does not exist)exp - the expiration of this objectOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
int by,
long def,
int exp)
decr in interface MemcachedClientIFkey - the keyby - the amount to decrementdef - the default value (if the counter does not exist)exp - the expiration of this objectOperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, long by)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value byjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, int by)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value byjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, long by)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value byjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, int by)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value byjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, long by, long def, int exp)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value bydef - the default value (if the counter does not exist)exp - the expiration of this objectjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, int by, long def, int exp)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value bydef - the default value (if the counter does not exist)exp - the expiration of this objectjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, long by, long def, int exp)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value bydef - the default value (if the counter does not exist)exp - the expiration of this objectjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, int by, long def, int exp)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value bydef - the default value (if the counter does not exist)exp - the expiration of this objectjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, long by, long def)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value bydef - the default value (if the counter does not exist)java.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncIncr(java.lang.String key, int by, long def)
asyncIncr in interface MemcachedClientIFkey - key to incrementby - the amount to increment the value bydef - the default value (if the counter does not exist)java.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, long by, long def)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value bydef - the default value (if the counter does not exist)java.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Long> asyncDecr(java.lang.String key, int by, long def)
asyncDecr in interface MemcachedClientIFkey - key to decrementby - the amount to decrement the value bydef - the default value (if the counter does not exist)java.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
long by,
long def)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementdef - the default value (if the counter does not exist)OperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long incr(java.lang.String key,
int by,
long def)
incr in interface MemcachedClientIFkey - the keyby - the amount to incrementdef - the default value (if the counter does not exist)OperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
long by,
long def)
decr in interface MemcachedClientIFkey - the keyby - the amount to decrementdef - the default value (if the counter does not exist)OperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic long decr(java.lang.String key,
int by,
long def)
decr in interface MemcachedClientIFkey - the keyby - the amount to decrementdef - the default value (if the counter does not exist)OperationTimeoutException - if the global operation timeout is
exceededjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requests@Deprecated public OperationFuture<java.lang.Boolean> delete(java.lang.String key, int hold)
The hold argument specifies the amount of time in seconds (or Unix time until which) the client wishes the server to refuse "add" and "replace" commands with this key. For this amount of item, the item is put into a delete queue, which means that it won't possible to retrieve it by the "get" command, but "add" and "replace" command with this key will also fail (the "set" command will succeed, however). After the time passes, the item is finally deleted from server memory.
key - the key to deletehold - how long the key should be unavailable to add commandspublic OperationFuture<java.lang.Boolean> delete(java.lang.String key)
delete in interface MemcachedClientIFkey - the key to deletejava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> delete(java.lang.String key, long cas)
delete in interface MemcachedClientIFkey - the key to deletecas - the CAS value to apply.java.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> flush(int delay)
flush in interface MemcachedClientIFdelay - the period of time to delay, in secondsjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic OperationFuture<java.lang.Boolean> flush()
flush in interface MemcachedClientIFjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic boolean refreshCertificate()
refreshCertificate in interface MemcachedClientIFOperationTimeoutException - if the global operation timeout is exceededpublic java.util.Set<java.lang.String> listSaslMechanisms()
MemcachedClientIFlistSaslMechanisms in interface MemcachedClientIFpublic void shutdown()
shutdown in interface MemcachedClientIFpublic boolean shutdown(long timeout,
java.util.concurrent.TimeUnit unit)
shutdown in interface MemcachedClientIFtimeout - the amount of time time for shutdownunit - the TimeUnit for the timeoutpublic boolean waitForQueues(long timeout,
java.util.concurrent.TimeUnit unit)
waitForQueues in interface MemcachedClientIFtimeout - the amount of time time for shutdownunit - the TimeUnit for the timeoutjava.lang.IllegalStateException - in the rare circumstance where queue is too
full to accept any more requestspublic boolean addObserver(ConnectionObserver obs)
addObserver in interface MemcachedClientIFobs - the ConnectionObserver you wish to addpublic boolean removeObserver(ConnectionObserver obs)
removeObserver in interface MemcachedClientIFobs - the ConnectionObserver you wish to addpublic void connectionEstablished(java.net.SocketAddress sa,
int reconnectCount)
ConnectionObserverconnectionEstablished in interface ConnectionObserversa - the address of the node whose connection was establishedreconnectCount - the number of attempts before the connection was
establishedpublic void connectionLost(java.net.SocketAddress sa)
ConnectionObserverconnectionLost in interface ConnectionObserversa - the address of the node whose connection was lostpublic boolean isConfigurationProtocolSupported()
public boolean isConfigurationInitialized()
public long getOperationTimeout()
public MemcachedConnection getConnection()
public TranscodeService getTranscoderService()
public java.util.concurrent.ExecutorService getExecutorService()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2006-2009 Dustin Sallings, 2009-2013 Couchbase, Inc.