Class MemcachedClient
- All Implemented Interfaces:
ConnectionObserver,MemcachedClientIF
Basic usage
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
Advanced Usage
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".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AuthDescriptorprotected final AuthThreadMonitorprotected final ClientModeprotected final ConnectionFactoryprotected final ExecutorServiceprotected MemcachedConnectionprotected final longprotected final OperationFactoryprotected booleanprotected final TranscodeServiceprotected final Transcoder<Object> Fields inherited from interface net.spy.memcached.MemcachedClientIF
MAX_KEY_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionMemcachedClient(InetSocketAddress... addrs) Get a memcache client operating on the specified memcached locations.MemcachedClient(List<InetSocketAddress> addrs) Get a memcache client over the specified memcached locations.MemcachedClient(ConnectionFactory cf, List<InetSocketAddress> addrs) -
Method Summary
Modifier and TypeMethodDescriptionAdd an object to the cache (using the default transcoder) iff it does not exist already.<T> OperationFuture<Boolean> add(String key, int exp, T o, Transcoder<T> tc) Add an object to the cache iff it does not exist already.booleanAdd a connection observer.Append to an existing value in the cache.<T> OperationFuture<Boolean> append(long cas, String key, T val, Transcoder<T> tc) Append to an existing value in the cache.Append to an existing value in the cache.<T> OperationFuture<Boolean> append(String key, T val, Transcoder<T> tc) Append to an existing value in the cache.Asynchronous CAS operation using the default transcoder with expiration.asyncCAS(String key, long casId, int exp, T value, Transcoder<T> tc) Asynchronous CAS operation.Asynchronous CAS operation using the default transcoder.asyncCAS(String key, long casId, T value, Transcoder<T> tc) Asynchronous CAS operation.Asynchronous decrement.Asynchronous decrement.Asynchronous decrement.Asynchronous decrement.Asynchronous decrement.Asynchronous decrement.Get the given key asynchronously and decode with the default transcoder.<T> GetFuture<T> asyncGet(String key, Transcoder<T> tc) Get the given key asynchronously.asyncGetAndTouch(String key, int exp) Get the given key to reset its expiration time.<T> OperationFuture<CASValue<T>> asyncGetAndTouch(String key, int exp, Transcoder<T> tc) Get the given key to reset its expiration time.asyncGetBulk(String... keys) Varargs wrapper for asynchronous bulk gets with the default transcoder.asyncGetBulk(Collection<String> keys) Asynchronously get a bunch of objects from the cache and decode them with the given transcoder.<T> BulkFuture<Map<String, T>> asyncGetBulk(Collection<String> keys, Iterator<Transcoder<T>> tcIter) Asynchronously get a bunch of objects from the cache.<T> BulkFuture<Map<String, T>> asyncGetBulk(Collection<String> keys, Transcoder<T> tc) Asynchronously get a bunch of objects from the cache.asyncGetBulk(Iterator<String> keyIter) Asynchronously get a bunch of objects from the cache and decode them with the given transcoder.<T> BulkFuture<Map<String, T>> asyncGetBulk(Iterator<String> keyIter, Iterator<Transcoder<T>> tcIter) Asynchronously get a bunch of objects from the cache.<T> BulkFuture<Map<String, T>> asyncGetBulk(Iterator<String> keyIter, Transcoder<T> tc) Asynchronously get a bunch of objects from the cache.<T> BulkFuture<Map<String, T>> asyncGetBulk(Transcoder<T> tc, String... keys) Varargs wrapper for asynchronous bulk gets.<T> GetConfigFuture<T> asyncGetConfig(InetSocketAddress addr, ConfigurationType type, Transcoder<T> tc) Get the given configurationType asynchronously.Gets (with CAS support) the given key asynchronously and decode using the default transcoder.<T> OperationFuture<CASValue<T>> asyncGets(String key, Transcoder<T> tc) Gets (with CAS support) the given key asynchronously.Asychronous increment.Asychronous increment.Asychronous increment.Asychronous increment.Asychronous increment.Asychronous increment.broadcastOp(BroadcastOpFactory of, Collection<MemcachedNode> nodes) Perform a synchronous CAS operation with the default transcoder.<T> CASResponsecas(String key, long casId, int exp, T value, Transcoder<T> tc) Perform a synchronous CAS operation.Perform a synchronous CAS operation with the default transcoder.<T> CASResponsecas(String key, long casId, T value, Transcoder<T> tc) Perform a synchronous CAS operation.voidconnectionEstablished(SocketAddress sa, int reconnectCount) A connection has just successfully been established on the given socket.voidA connection was just lost on the given socket.longDecrement the given key by the given value.longDecrement the given counter, returning the new value.longDecrement the given counter, returning the new value.longDecrement the given key by the given value.longDecrement the given counter, returning the new value.longDecrement the given counter, returning the new value.Delete the given key from the cache.Deprecated.Hold values are no longer honored.Delete the given key from the cache of the given CAS value applies.deleteConfig(InetSocketAddress addr, ConfigurationType configurationType) Delete the given configurationType from the cache server.flush()Flush all caches from all servers immediately.flush(int delay) Flush all caches from all servers with a delay of application.Get with a single key and decode using the default transcoder.<T> Tget(String key, Transcoder<T> tc) Get with a single key.Get the endpoints of all servers.getAndTouch(String key, int exp) Get a single key and reset its expiration using the default transcoder.<T> CASValue<T> getAndTouch(String key, int exp, Transcoder<T> tc) Get with a single key and reset its expiration.Get the endpoints of available servers.Get the addresses of available servers.Get the values for multiple keys from the cache.getBulk(Collection<String> keys) Get the values for multiple keys from the cache.getBulk(Collection<String> keys, Transcoder<T> tc) Get the values for multiple keys from the cache.Get the values for multiple keys from the cache.getBulk(Iterator<String> keyIter, Transcoder<T> tc) Get the values for multiple keys from the cache.getBulk(Transcoder<T> tc, String... keys) Get the values for multiple keys from the cache.getConfig(InetSocketAddress addr, ConfigurationType type) Get the config<T> TgetConfig(InetSocketAddress addr, ConfigurationType type, Transcoder<T> tc) Get the config using the config protocol.Get a read-only wrapper around the node locator wrapping this instance.longGets (with CAS support) with a single key using the default transcoder.<T> CASValue<T> gets(String key, Transcoder<T> tc) Gets (with CAS support) with a single key.getStats()Get all of the stats from all of the connections.Get a set of stats from all connections.Get the default transcoder that's in use.Get the addresses of unavailable servers.Get the versions of all of the connected memcacheds.longIncrement the given key by the given amount.longIncrement the given counter, returning the new value.longIncrement the given counter, returning the new value.longIncrement the given key by the given amount.longIncrement the given counter, returning the new value.longIncrement the given counter, returning the new value.booleanbooleanGet the set of SASL mechanisms supported by the servers.Prepend to an existing value in the cache.<T> OperationFuture<Boolean> prepend(long cas, String key, T val, Transcoder<T> tc) Prepend to an existing value in the cache.Prepend to an existing value in the cache.<T> OperationFuture<Boolean> prepend(String key, T val, Transcoder<T> tc) Prepend to an existing value in the cache.booleanRefresh the TLS certificate on all memcached nodes for the current clientbooleanRemove a connection observer.Replace an object with the given value (transcoded with the default transcoder) iff there is already a value for the given key.<T> OperationFuture<Boolean> replace(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.Set an object in the cache (using the default transcoder) regardless of any existing value.<T> OperationFuture<Boolean> set(String key, int exp, T o, Transcoder<T> tc) Set an object in the cache regardless of any existing value.setConfig(InetSocketAddress addr, ConfigurationType configurationType, Object o) Sets the configuration in the cache node for the specified configurationType.<T> OperationFuture<Boolean> setConfig(InetSocketAddress addr, ConfigurationType configurationType, Object o, Transcoder<T> tc) Sets the configuration in the cache node for the specified configurationType.voidshutdown()Shut down immediately.booleanShut down this client gracefully.toString()<T> OperationFuture<Boolean> Touch the given key to reset its expiration time with the default transcoder.<T> OperationFuture<Boolean> touch(String key, int exp, Transcoder<T> tc) Touch the given key to reset its expiration time.booleanwaitForQueues(long timeout, TimeUnit unit) Wait for the queues to die down.
-
Field Details
-
clientMode
-
shuttingDown
protected volatile boolean shuttingDown -
operationTimeout
protected final long operationTimeout -
mconn
-
opFact
-
transcoder
-
tcService
-
authDescriptor
-
connFactory
-
authMonitor
-
executorService
-
-
Constructor Details
-
MemcachedClient
Get a memcache client operating on the specified memcached locations.- Parameters:
addrs- the memcached locations- Throws:
IOException
-
MemcachedClient
Get a memcache client over the specified memcached locations.- Parameters:
addrs- the socket addrs- Throws:
IOException- if connections cannot be established
-
MemcachedClient
- Throws:
IOException
-
-
Method Details
-
getConfigurationNode
-
getAvailableServers
Get the addresses of available servers.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.
- Specified by:
getAvailableServersin interfaceMemcachedClientIF- Returns:
- point-in-time view of currently available servers
-
getAvailableNodeEndPoints
Get the endpoints of available servers. Use this method instead of "getAvailableServers" if details about hostname, ipAddress and port of the servers are required.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.
- Returns:
- point-in-time view of currently available servers
-
getAllNodeEndPoints
Get the endpoints of all servers.- Returns:
- point-in-time view of current list of servers
-
getNodeLocator
Get a read-only wrapper around the node locator wrapping this instance.- Specified by:
getNodeLocatorin interfaceMemcachedClientIF- Returns:
- this instance's NodeLocator
-
getTranscoder
Get the default transcoder that's in use.- Specified by:
getTranscoderin interfaceMemcachedClientIF- Returns:
- this instance's Transcoder
-
broadcastOp
- Specified by:
broadcastOpin interfaceMemcachedClientIF
-
broadcastOp
- Specified by:
broadcastOpin interfaceMemcachedClientIF
-
touch
Touch the given key to reset its expiration time with the default transcoder.- Specified by:
touchin interfaceMemcachedClientIF- Parameters:
key- the key to fetchexp- the new expiration to set for the given key- Returns:
- a future that will hold the return value of whether or not the fetch succeeded
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
touch
Touch the given key to reset its expiration time.- Specified by:
touchin interfaceMemcachedClientIF- Parameters:
key- the key to fetchexp- the new expiration to set for the given keytc- the transcoder to serialize and unserialize value- Returns:
- a future that will hold the return value of whether or not the fetch succeeded
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
append
Append to an existing value in the cache. If 0 is passed in as the CAS identifier, it will override the value on the server without performing the CAS check.Note that the return will be false any time a mutation has not occurred.
- Specified by:
appendin interfaceMemcachedClientIF- Parameters:
cas- cas identifier (ignored in the ascii protocol)key- the key to whose value will be appendedval- the value to append- Returns:
- a future indicating success, false if there was no change to the value
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
append
Append to an existing value in the cache.Note that the return will be false any time a mutation has not occurred.
- Specified by:
appendin interfaceMemcachedClientIF- Parameters:
key- the key to whose value will be appendedval- the value to append- Returns:
- a future indicating success, false if there was no change to the value
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
append
Append to an existing value in the cache. If 0 is passed in as the CAS identifier, it will override the value on the server without performing the CAS check.Note that the return will be false any time a mutation has not occurred.
- Specified by:
appendin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
append
Append to an existing value in the cache. If 0 is passed in as the CAS identifier, it will override the value on the server without performing the CAS check.Note that the return will be false any time a mutation has not occurred.
- Specified by:
appendin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to whose value will be appendedval- the value to appendtc- the transcoder to serialize and unserialize the value- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
prepend
Prepend to an existing value in the cache. If 0 is passed in as the CAS identifier, it will override the value on the server without performing the CAS check.Note that the return will be false any time a mutation has not occurred.
- Specified by:
prependin interfaceMemcachedClientIF- Parameters:
cas- cas identifier (ignored in the ascii protocol)key- the key to whose value will be prependedval- the value to append- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
prepend
Prepend to an existing value in the cache.Note that the return will be false any time a mutation has not occurred.
- Specified by:
prependin interfaceMemcachedClientIF- Parameters:
key- the key to whose value will be prependedval- the value to append- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
prepend
Prepend to an existing value in the cache. If 0 is passed in as the CAS identifier, it will override the value on the server without performing the CAS check.Note that the return will be false any time a mutation has not occurred.
- Specified by:
prependin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
prepend
Prepend to an existing value in the cache.Note that the return will be false any time a mutation has not occurred.
- Specified by:
prependin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to whose value will be prependedval- the value to appendtc- the transcoder to serialize and unserialize the value- Returns:
- a future indicating success
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncCAS
Asynchronous CAS operation.- Specified by:
asyncCASin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)value- the new valuetc- the transcoder to serialize and unserialize the value- Returns:
- a future that will indicate the status of the CAS
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncCAS
public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, T value, Transcoder<T> tc) Asynchronous CAS operation.- Specified by:
asyncCASin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future that will indicate the status of the CAS
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncCAS
Asynchronous CAS operation using the default transcoder.- Specified by:
asyncCASin interfaceMemcachedClientIF- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)value- the new value- Returns:
- a future that will indicate the status of the CAS
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncCAS
Asynchronous CAS operation using the default transcoder with expiration.- Specified by:
asyncCASin interfaceMemcachedClientIF- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)exp- the expiration of this objectvalue- the new value- Returns:
- a future that will indicate the status of the CAS
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
cas
Perform a synchronous CAS operation.- Specified by:
casin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)value- the new valuetc- the transcoder to serialize and unserialize the value- Returns:
- a CASResponse
- Throws:
OperationTimeoutException- if global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
cas
Perform a synchronous CAS operation.- Specified by:
casin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a CASResponse
- Throws:
OperationTimeoutException- if global operation timeout is exceededCancellationException- if operation was canceledIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
cas
Perform a synchronous CAS operation with the default transcoder.- Specified by:
casin interfaceMemcachedClientIF- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)value- the new value- Returns:
- a CASResponse
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
cas
Perform a synchronous CAS operation with the default transcoder.- Specified by:
casin interfaceMemcachedClientIF- Parameters:
key- the keycasId- the CAS identifier (from a gets operation)exp- the expiration of this objectvalue- the new value- Returns:
- a CASResponse
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
add
Add an object to the cache iff it does not exist already.The
expvalue 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.
- Specified by:
addin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
add
Add an object to the cache (using the default transcoder) iff it does not exist already.The
expvalue 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.
- Specified by:
addin interfaceMemcachedClientIF- Parameters:
key- the key under which this object should be added.exp- the expiration of this objecto- the object to store- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
set
Set an object in the cache regardless of any existing value.The
expvalue 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.
- Specified by:
setin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
set
Set an object in the cache (using the default transcoder) regardless of any existing value.The
expvalue 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.
- Specified by:
setin interfaceMemcachedClientIF- Parameters:
key- the key under which this object should be added.exp- the expiration of this objecto- the object to store- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
replace
Replace an object with the given value iff there is already a value for the given key.The
expvalue 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.
- Specified by:
replacein interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 value- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
replace
Replace an object with the given value (transcoded with the default transcoder) iff there is already a value for the given key.The
expvalue 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.
- Specified by:
replacein interfaceMemcachedClientIF- Parameters:
key- the key under which this object should be added.exp- the expiration of this objecto- the object to store- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGet
Get the given key asynchronously.- Specified by:
asyncGetin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to fetchtc- the transcoder to serialize and unserialize value- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGet
Get the given key asynchronously and decode with the default transcoder.- Specified by:
asyncGetin interfaceMemcachedClientIF- Parameters:
key- the key to fetch- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGets
Gets (with CAS support) the given key asynchronously.- Specified by:
asyncGetsin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to fetchtc- the transcoder to serialize and unserialize value- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGets
Gets (with CAS support) the given key asynchronously and decode using the default transcoder.- Specified by:
asyncGetsin interfaceMemcachedClientIF- Parameters:
key- the key to fetch- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
gets
Gets (with CAS support) with a single key.- Specified by:
getsin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to gettc- the transcoder to serialize and unserialize value- Returns:
- the result from the cache and CAS id (null if there is none)
- Throws:
OperationTimeoutException- if global operation timeout is exceededCancellationException- if operation was canceledIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getAndTouch
Get with a single key and reset its expiration.- Specified by:
getAndTouchin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to getexp- the new expiration for the keytc- the transcoder to serialize and unserialize value- Returns:
- the result from the cache (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededCancellationException- if operation was canceledIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getAndTouch
Get a single key and reset its expiration using the default transcoder.- Specified by:
getAndTouchin interfaceMemcachedClientIF- Parameters:
key- the key to getexp- the new expiration for the key- Returns:
- the result from the cache and CAS id (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
gets
Gets (with CAS support) with a single key using the default transcoder.- Specified by:
getsin interfaceMemcachedClientIF- Parameters:
key- the key to get- Returns:
- the result from the cache and CAS id (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
get
Get with a single key.- Specified by:
getin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
key- the key to gettc- the transcoder to serialize and unserialize value- Returns:
- the result from the cache (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededCancellationException- if operation was canceledIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
get
Get with a single key and decode using the default transcoder.- Specified by:
getin interfaceMemcachedClientIF- Parameters:
key- the key to get- Returns:
- the result from the cache (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
public <T> BulkFuture<Map<String,T>> asyncGetBulk(Iterator<String> keyIter, Iterator<Transcoder<T>> tcIter) Asynchronously get a bunch of objects from the cache.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 match- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
public <T> BulkFuture<Map<String,T>> asyncGetBulk(Collection<String> keys, Iterator<Transcoder<T>> tcIter) Asynchronously get a bunch of objects from the cache.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
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 match- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Asynchronously get a bunch of objects from the cache.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
keyIter- Iterator for the keys to requesttc- the transcoder to serialize and unserialize values- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Asynchronously get a bunch of objects from the cache.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
keys- the keys to requesttc- the transcoder to serialize and unserialize values- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Asynchronously get a bunch of objects from the cache and decode them with the given transcoder.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Parameters:
keyIter- Iterator that produces the keys to request- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Asynchronously get a bunch of objects from the cache and decode them with the given transcoder.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Parameters:
keys- the keys to request- Returns:
- a Future result of that fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Varargs wrapper for asynchronous bulk gets.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
tc- the transcoder to serialize and unserialize valuekeys- one more more keys to get- Returns:
- the future values of those keys
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetBulk
Varargs wrapper for asynchronous bulk gets with the default transcoder.- Specified by:
asyncGetBulkin interfaceMemcachedClientIF- Parameters:
keys- one more more keys to get- Returns:
- the future values of those keys
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetAndTouch
Get the given key to reset its expiration time.- Specified by:
asyncGetAndTouchin interfaceMemcachedClientIF- Parameters:
key- the key to fetchexp- the new expiration to set for the given key- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetAndTouch
Get the given key to reset its expiration time.- Specified by:
asyncGetAndTouchin interfaceMemcachedClientIF- Parameters:
key- the key to fetchexp- the new expiration to set for the given keytc- the transcoder to serialize and unserialize value- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
keyIter- Iterator that produces the keystc- the transcoder to serialize and unserialize value- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededCancellationException- if operation was canceledIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Parameters:
keyIter- Iterator that produces the keys- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
keys- the keystc- the transcoder to serialize and unserialize value- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Parameters:
keys- the keys- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Type Parameters:
T-- Parameters:
tc- the transcoder to serialize and unserialize valuekeys- the keys- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getBulk
Get the values for multiple keys from the cache.- Specified by:
getBulkin interfaceMemcachedClientIF- Parameters:
keys- the keys- Returns:
- a map of the values (for each value that exists)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getConfig
Get the config- Parameters:
addr- - The node from which to retrieve the configurationtype- - config to get- Returns:
- the result from the server.
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getConfig
Get the config using the config protocol. The command format is "config get <type>"- Parameters:
addr- - The node from which to retrieve the configurationtype- config to gettc- the transcoder to serialize and unserialize value- Returns:
- the result from the server (null if there is none)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncGetConfig
public <T> GetConfigFuture<T> asyncGetConfig(InetSocketAddress addr, ConfigurationType type, Transcoder<T> tc) Get the given configurationType asynchronously.- Parameters:
addr- - The node from which to retrieve the configurationtype- the configurationType to fetchtc- the transcoder to serialize and unserialize value- Returns:
- a future that will hold the return value of the fetch
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
setConfig
public OperationFuture<Boolean> setConfig(InetSocketAddress addr, ConfigurationType configurationType, Object o) Sets the configuration in the cache node for the specified configurationType.- Parameters:
addr- - The node where the configuration is set.configurationType- the type under which this configuration should be added.o- the configuration to store- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
setConfig
public <T> OperationFuture<Boolean> setConfig(InetSocketAddress addr, ConfigurationType configurationType, Object o, Transcoder<T> tc) Sets the configuration in the cache node for the specified configurationType.- Parameters:
addr- - The node where the configuration is set.configurationType- the type under which this configuration should be added.o- the configuration to storetc- the transcoder to serialize and unserialize the configuration- Returns:
- a future representing the processing of this operation
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
deleteConfig
public OperationFuture<Boolean> deleteConfig(InetSocketAddress addr, ConfigurationType configurationType) Delete the given configurationType from the cache server.- Parameters:
addr- - The node in which the configuration is deleted.configurationType- the configurationType to delete- Returns:
- whether or not the operation was performed
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getVersions
Get the versions of all of the connected memcacheds.- Specified by:
getVersionsin interfaceMemcachedClientIF- Returns:
- a Map of SocketAddress to String for connected servers
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getStats
Get all of the stats from all of the connections.- Specified by:
getStatsin interfaceMemcachedClientIF- Returns:
- a Map of a Map of stats replies by SocketAddress
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
getStats
Get a set of stats from all connections.- Specified by:
getStatsin interfaceMemcachedClientIF- Parameters:
arg- which stats to get- Returns:
- a Map of the server SocketAddress to a map of String stat keys to String stat values.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given key by the given amount. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to increment- Returns:
- the new value (-1 if the key doesn't exist)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given key by the given amount. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to increment- Returns:
- the new value (-1 if the key doesn't exist)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given key by the given value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the value- Returns:
- the new value (-1 if the key doesn't exist)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given key by the given value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the value- Returns:
- the new value (-1 if the key doesn't exist)
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given counter, returning the new value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to incrementdef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- the new value, or -1 if we were unable to increment or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given counter, returning the new value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to incrementdef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- the new value, or -1 if we were unable to increment or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given counter, returning the new value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to decrementdef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- the new value, or -1 if we were unable to decrement or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given counter, returning the new value. Due to the way the memcached server operates on items, incremented and decremented items will be returned as Strings with any operations that return a value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to decrementdef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- the new value, or -1 if we were unable to decrement or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value by- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value by- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value by- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value by- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value bydef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value bydef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value bydef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value bydef- the default value (if the counter does not exist)exp- the expiration of this object- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value bydef- the default value (if the counter does not exist)- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncIncr
Asychronous increment.- Specified by:
asyncIncrin interfaceMemcachedClientIF- Parameters:
key- key to incrementby- the amount to increment the value bydef- the default value (if the counter does not exist)- Returns:
- a future with the incremented value, or -1 if the increment failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value bydef- the default value (if the counter does not exist)- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
asyncDecr
Asynchronous decrement.- Specified by:
asyncDecrin interfaceMemcachedClientIF- Parameters:
key- key to decrementby- the amount to decrement the value bydef- the default value (if the counter does not exist)- Returns:
- a future with the decremented value, or -1 if the decrement failed.
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given counter, returning the new value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to incrementdef- the default value (if the counter does not exist)- Returns:
- the new value, or -1 if we were unable to increment or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
incr
Increment the given counter, returning the new value.- Specified by:
incrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to incrementdef- the default value (if the counter does not exist)- Returns:
- the new value, or -1 if we were unable to increment or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given counter, returning the new value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to decrementdef- the default value (if the counter does not exist)- Returns:
- the new value, or -1 if we were unable to decrement or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
decr
Decrement the given counter, returning the new value.- Specified by:
decrin interfaceMemcachedClientIF- Parameters:
key- the keyby- the amount to decrementdef- the default value (if the counter does not exist)- Returns:
- the new value, or -1 if we were unable to decrement or add
- Throws:
OperationTimeoutException- if the global operation timeout is exceededIllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
delete
Deprecated.Hold values are no longer honored.Delete the given key from the cache.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.
- Parameters:
key- the key to deletehold- how long the key should be unavailable to add commands- Returns:
- whether or not the operation was performed
-
delete
Delete the given key from the cache.- Specified by:
deletein interfaceMemcachedClientIF- Parameters:
key- the key to delete- Returns:
- whether or not the operation was performed
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
delete
Delete the given key from the cache of the given CAS value applies.- Specified by:
deletein interfaceMemcachedClientIF- Parameters:
key- the key to deletecas- the CAS value to apply.- Returns:
- whether or not the operation was performed
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
flush
Flush all caches from all servers with a delay of application.- Specified by:
flushin interfaceMemcachedClientIF- Parameters:
delay- the period of time to delay, in seconds- Returns:
- whether or not the operation was accepted
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
flush
Flush all caches from all servers immediately.- Specified by:
flushin interfaceMemcachedClientIF- Returns:
- whether or not the operation was performed
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
refreshCertificate
public boolean refreshCertificate()Refresh the TLS certificate on all memcached nodes for the current client- Specified by:
refreshCertificatein interfaceMemcachedClientIF- Returns:
- true if the refresh succeeded, and false if error reply was received from any server
- Throws:
OperationTimeoutException- if the global operation timeout is exceeded
-
listSaslMechanisms
Description copied from interface:MemcachedClientIFGet the set of SASL mechanisms supported by the servers.- Specified by:
listSaslMechanismsin interfaceMemcachedClientIF- Returns:
- the union of all SASL mechanisms supported by the servers.
-
shutdown
public void shutdown()Shut down immediately.- Specified by:
shutdownin interfaceMemcachedClientIF
-
shutdown
Shut down this client gracefully.- Specified by:
shutdownin interfaceMemcachedClientIF- Parameters:
timeout- the amount of time time for shutdownunit- the TimeUnit for the timeout- Returns:
- result of the shutdown request
-
waitForQueues
Wait for the queues to die down.- Specified by:
waitForQueuesin interfaceMemcachedClientIF- Parameters:
timeout- the amount of time time for shutdownunit- the TimeUnit for the timeout- Returns:
- result of the request for the wait
- Throws:
IllegalStateException- in the rare circumstance where queue is too full to accept any more requests
-
addObserver
Add a connection observer. If connections are already established, your observer will be called with the address and -1.- Specified by:
addObserverin interfaceMemcachedClientIF- Parameters:
obs- the ConnectionObserver you wish to add- Returns:
- true if the observer was added.
-
removeObserver
Remove a connection observer.- Specified by:
removeObserverin interfaceMemcachedClientIF- Parameters:
obs- the ConnectionObserver you wish to add- Returns:
- true if the observer existed, but no longer does
-
connectionEstablished
Description copied from interface:ConnectionObserverA connection has just successfully been established on the given socket.- Specified by:
connectionEstablishedin interfaceConnectionObserver- Parameters:
sa- the address of the node whose connection was establishedreconnectCount- the number of attempts before the connection was established
-
connectionLost
Description copied from interface:ConnectionObserverA connection was just lost on the given socket.- Specified by:
connectionLostin interfaceConnectionObserver- Parameters:
sa- the address of the node whose connection was lost
-
isConfigurationProtocolSupported
public boolean isConfigurationProtocolSupported() -
isConfigurationInitialized
public boolean isConfigurationInitialized() -
getOperationTimeout
public long getOperationTimeout() -
getConnection
-
getTranscoderService
-
getExecutorService
-
toString
-