Package net.rubyeye.xmemcached
Class XMemcachedClient
- java.lang.Object
-
- net.rubyeye.xmemcached.XMemcachedClient
-
- All Implemented Interfaces:
MemcachedClient,XMemcachedClientMBean
- Direct Known Subclasses:
AWSElasticCacheClient
public class XMemcachedClient extends java.lang.Object implements XMemcachedClientMBean, MemcachedClient
Memcached Client for connecting to memcached server and do operations.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.net.InetSocketAddress,AuthInfo>authInfoMapprivate java.util.Map<java.lang.String,AuthInfo>authInfoStringMapprotected CommandFactorycommandFactoryprotected intconnectionPoolSizeprotected MemcachedConnectorconnectorprivate longconnectTimeoutprivate static java.lang.StringCONTINUOUS_TIMEOUT_COUNTERprivate booleanfailureModeprivate booleanisHutdownHookCalledprivate KeyProviderkeyProviderprivate static org.slf4j.Loggerlogprotected intmaxQueuedNoReplyOperationsprivate MemcachedHandlermemcachedHandlerprivate java.lang.Stringnamestatic java.lang.ThreadLocal<java.lang.String>NAMESPACE_LOCALnamespace thread local.protected longopTimeoutprotected booleanresolveInetAddressesprivate booleansanitizeKeysprotected java.util.concurrent.atomic.AtomicIntegerserverOrderCountprotected MemcachedSessionComparatorsessionComparatorprotected MemcachedSessionLocatorsessionLocatorprivate booleanshutdownprivate java.lang.ThreadshutdownHookThreadprivate java.util.concurrent.CopyOnWriteArrayList<MemcachedClientStateListenerAdapter>stateListenerAdaptersprivate inttimeoutExceptionThresholdprivate Transcodertranscoder-
Fields inherited from interface net.rubyeye.xmemcached.MemcachedClient
DEFAULT_CONNECT_TIMEOUT, DEFAULT_CONNECTION_POOL_SIZE, DEFAULT_HEAL_SESSION_INTERVAL, DEFAULT_MAX_QUEUED_NOPS, DEFAULT_MAX_TIMEOUTEXCEPTION_THRESHOLD, DEFAULT_OP_TIMEOUT, DEFAULT_READ_THREAD_COUNT, DEFAULT_SESSION_IDLE_TIMEOUT, DEFAULT_SESSION_READ_BUFF_SIZE, DEFAULT_TCP_KEEPLIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_RECV_BUFF_SIZE, DEFAULT_TCP_SEND_BUFF_SIZE, DYNAMIC_MAX_QUEUED_NOPS, MAX_QUEUED_NOPS
-
-
Constructor Summary
Constructors Constructor Description XMemcachedClient()XMemcachedClient(java.lang.String server, int port)XMemcached constructor,default weight is 1XMemcachedClient(java.lang.String host, int port, int weight)XMemcached constructorXMemcachedClient(java.net.InetSocketAddress inetSocketAddress)XMemcachedClient(java.net.InetSocketAddress inetSocketAddress, int weight)XMemcachedClient(java.net.InetSocketAddress inetSocketAddress, int weight, CommandFactory cmdFactory)XMemcached Constructor.XMemcachedClient(java.util.List<java.net.InetSocketAddress> addressList)XMemcached Constructor.Every server's weight is one by default.XMemcachedClient(java.util.List<java.net.InetSocketAddress> addressList, CommandFactory cmdFactory)XMemcached Constructor.Every server's weight is one by default.XMemcachedClient(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, java.util.Map<java.net.InetSocketAddress,java.net.InetSocketAddress> addressMap, int[] weights, java.util.List<MemcachedClientStateListener> stateListeners, java.util.Map<java.net.InetSocketAddress,AuthInfo> infoMap, int poolSize, long connectTimeout, java.lang.String name, boolean failureMode, boolean resolveInetAddresses)XMemcachedClient constructor.XMemcachedClient(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, java.util.Map<java.net.InetSocketAddress,java.net.InetSocketAddress> addressMap, java.util.List<MemcachedClientStateListener> stateListeners, java.util.Map<java.net.InetSocketAddress,AuthInfo> map, int poolSize, long connectTimeout, java.lang.String name, boolean failureMode, boolean resolveInetAddresses)XMemcachedClient constructor.Every server's weight is one by default.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanadd(java.lang.String key, int exp, java.lang.Object value)booleanadd(java.lang.String key, int exp, java.lang.Object value, long timeout)<T> booleanadd(java.lang.String key, int exp, T value, Transcoder<T> transcoder)<T> booleanadd(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout)Add key-value item to memcached, success only when the key is not exists in memcached.private <T> booleanadd0(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout)voidaddOneServerWithWeight(java.lang.String server, int weight)Add a memcached servervoidaddServer(java.lang.String hostList)Add memcached serversvoidaddServer(java.lang.String server, int port)Aadd a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)voidaddServer(java.lang.String server, int port, int weight)add a memcached server to MemcachedClientvoidaddServer(java.net.InetSocketAddress inetSocketAddress)Add a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)voidaddServer(java.net.InetSocketAddress inetSocketAddress, int weight)voidaddStateListener(MemcachedClientStateListener listener)Add a memcached client listenervoidaddWithNoReply(java.lang.String key, int exp, java.lang.Object value)Add key-value item to memcached, success only when the key is not exists in memcached.This method doesn't wait for reply.<T> voidaddWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)booleanappend(java.lang.String key, java.lang.Object value)booleanappend(java.lang.String key, java.lang.Object value, long timeout)Append value to key's data item,this method will wait for replyvoidappendWithNoReply(java.lang.String key, java.lang.Object value)Append value to key's data item,this method doesn't wait for reply.voidbeginWithNamespace(java.lang.String ns)set current namespace for following operations with memcached client.It must be ended withMemcachedClient.endWithNamespace()method.For example:private voidbuildConnector(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator bufferAllocator, Configuration configuration, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder)booleancas(java.lang.String key, int exp, java.lang.Object value, long cas)booleancas(java.lang.String key, int exp, java.lang.Object value, long timeout, long cas)<T> booleancas(java.lang.String key, int exp, CASOperation<T> operation)<T> booleancas(java.lang.String key, int exp, CASOperation<T> operation, Transcoder<T> transcoder)Cas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."<T> booleancas(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation)<T> booleancas(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation, Transcoder<T> transcoder)cas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."<T> booleancas(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long cas)<T> booleancas(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout, long cas)Cas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."<T> booleancas(java.lang.String key, CASOperation<T> operation)<T> booleancas(java.lang.String key, GetsResponse<T> getsReponse, CASOperation<T> operation)private <T> booleancas0(java.lang.String key, int exp, GetsResponse<T> getsResponse, CASOperation<T> operation, Transcoder<T> transcoder, byte[] keyBytes, boolean noreply)<T> voidcasWithNoReply(java.lang.String key, int exp, CASOperation<T> operation)<T> voidcasWithNoReply(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation)cas noreply<T> voidcasWithNoReply(java.lang.String key, CASOperation<T> operation)<T> voidcasWithNoReply(java.lang.String key, GetsResponse<T> getsResponse, CASOperation<T> operation)private java.util.Collection<java.util.List<java.lang.String>>catalogKeys(java.util.Collection<java.lang.String> keyCollections)Hash key to serversprotected voidcheckException(Command command)private voidcheckServerPort(java.lang.String server, int port)private <T> byte[]checkStoreArguments(java.lang.String key, int exp, T value)protected voidconnect(InetSocketAddressWrapper inetSocketAddressWrapper)private java.lang.StringdecodeKey(java.lang.String key)longdecr(java.lang.String key, long delta)"decr" are used to change data for some item in-place, decrementing it.longdecr(java.lang.String key, long delta, long initValue)longdecr(java.lang.String key, long delta, long initValue, long timeout)"decr" are used to change data for some item in-place, decrementing it.longdecr(java.lang.String key, long delta, long initValue, long timeout, int exp)"incr" are used to change data for some item in-place, incrementing it.voiddecrWithNoReply(java.lang.String key, long delta)"decr" are used to change data for some item in-place, decrementing it.booleandelete(java.lang.String key)booleandelete(java.lang.String key, int time)Delete key's data item from memcached.It it is not exists,return false. time is 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.booleandelete(java.lang.String key, long opTimeout)Delete key's date item from memcachedbooleandelete(java.lang.String key, long cas, long opTimeout)Delete key's date item from memcached only if its cas value is the same as what was read.private booleandelete0(java.lang.String key, int time, long cas, boolean noreply, long opTimeout)voiddeleteWithNoReply(java.lang.String key)voiddeleteWithNoReply(java.lang.String key, int time)Delete key's data item from memcached.This method doesn't wait for replyvoidendWithNamespace()Remove current namespace set for this memcached client.It must begin withMemcachedClient.beginWithNamespace(String)method.private <T> java.lang.Objectfetch0(java.lang.String key, byte[] keyBytes, CommandType cmdType, long timeout, Transcoder<T> transcoder)voidflushAll()Make All connected memcached's data item invalidvoidflushAll(int exptime, long timeout)voidflushAll(long timeout)Make All connected memcached's data item invalidvoidflushAll(java.lang.String host)This method is deprecated,please use flushAll(InetSocketAddress) instead.voidflushAll(java.net.InetSocketAddress address)Invalidate all existing items immediatelyvoidflushAll(java.net.InetSocketAddress address, long timeout)voidflushAll(java.net.InetSocketAddress address, long timeout, int exptime)private voidflushAllMemcachedServers(long timeout, boolean noreply, int exptime)voidflushAllWithNoReply()voidflushAllWithNoReply(int exptime)voidflushAllWithNoReply(java.net.InetSocketAddress address)voidflushAllWithNoReply(java.net.InetSocketAddress address, int exptime)private voidflushSpecialMemcachedServer(java.net.InetSocketAddress address, long timeout, boolean noreply, int exptime)<T> Tget(java.lang.String key)<T> Tget(java.lang.String key, long timeout)<T> Tget(java.lang.String key, long timeout, Transcoder<T> transcoder)Get value by key<T> Tget(java.lang.String key, Transcoder<T> transcoder)<T> java.util.Map<java.lang.String,T>get(java.util.Collection<java.lang.String> keyCollections)<T> java.util.Map<java.lang.String,T>get(java.util.Collection<java.lang.String> keyCollections, long timeout)<T> java.util.Map<java.lang.String,T>get(java.util.Collection<java.lang.String> keyCollections, long timeout, Transcoder<T> transcoder)Bulk get items<T> java.util.Map<java.lang.String,T>get(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder)private <T> java.lang.Objectget0(java.lang.String key, long timeout, CommandType cmdType, Transcoder<T> transcoder)<T> TgetAndTouch(java.lang.String key, int newExp)Get item and set a new expiration time for it,using default opTimeout<T> TgetAndTouch(java.lang.String key, int newExp, long opTimeout)Get item and set a new expiration time for itjava.util.Map<java.net.InetSocketAddress,AuthInfo>getAuthInfoMap()return current all auth infojava.util.Map<java.lang.String,AuthInfo>getAuthInfoStringMap()Retruns the AuthInfo for all server strings (hostname:port)java.util.Collection<java.net.InetSocketAddress>getAvailableServers()Returns available memcached servers list.java.util.Collection<java.net.InetSocketAddress>getAvaliableServers()Deprecated.CommandFactorygetCommandFactory()intgetConnectionSizeBySocketAddress(java.net.InetSocketAddress address)ConnectorgetConnector()return the session managerlonggetConnectTimeout()Get the connect timeoutprivate java.util.concurrent.atomic.AtomicIntegergetContinuousTimeoutCounter(Session session)CountergetCounter(java.lang.String key)Get counter for key,and if the key's value is not set,then set it with 0.CountergetCounter(java.lang.String key, long initialValue)Get counter for key,and if the key's value is not set,then set it with initial value.longgetHealSessionInterval()Return the default heal session interval in millisecondsKeyIteratorgetKeyIterator(java.net.InetSocketAddress address)Deprecated.memcached 1.6.x will remove cachedump stats command,so this method will be removed in the futureKeyProvidergetKeyProvider()private <T> java.util.Map<java.lang.String,T>getMulti0(java.util.Collection<java.lang.String> keys, long timeout, CommandType cmdType, Transcoder<T> transcoder)java.lang.StringgetName()Return the cache instance namejava.lang.StringgetNamespace(java.lang.String ns)Returns the real namespace of ns.private java.lang.StringgetNSKey(java.lang.String ns)longgetOpTimeout()get operation timeout settingProtocolgetProtocol()java.util.Queue<ReconnectRequest>getReconnectRequestQueue()Returns reconnecting task queue,the queue is thread-safe and 'weakly consistent',but maybe you should not modify it at all.<T> GetsResponse<T>gets(java.lang.String key)<T> GetsResponse<T>gets(java.lang.String key, long timeout)<T> GetsResponse<T>gets(java.lang.String key, long timeout, Transcoder<T> transcoder)Just like get,But it return a GetsResponse,include cas value for cas update.<T> GetsResponse<T>gets(java.lang.String key, Transcoder transcoder)<T> java.util.Map<java.lang.String,GetsResponse<T>>gets(java.util.Collection<java.lang.String> keyCollections)<T> java.util.Map<java.lang.String,GetsResponse<T>>gets(java.util.Collection<java.lang.String> keyCollections, long timeout)<T> java.util.Map<java.lang.String,GetsResponse<T>>gets(java.util.Collection<java.lang.String> keyCollections, long timeout, Transcoder<T> transcoder)Bulk gets items<T> java.util.Map<java.lang.String,GetsResponse<T>>gets(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder)private <T> GetsResponse<T>gets0(java.lang.String key, byte[] keyBytes, Transcoder<T> transcoder)java.util.List<java.lang.String>getServersDescription()Get all connected memcached serversMemcachedSessionComparatorgetSessionComparator()MemcachedSessionLocatorgetSessionLocator()java.util.Collection<MemcachedClientStateListener>getStateListeners()Get all current state listenersjava.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>>getStats()java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>>getStats(long timeout)Get stats from all memcached serversjava.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>>getStatsByItem(java.lang.String itemName)Get special item stats.java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>>getStatsByItem(java.lang.String itemName, long timeout)intgetTimeoutExceptionThreshold()Returns maximum number of timeout exception for closing connection.TranscodergetTranscoder()return default transcoder,default is SerializingTranscoderjava.util.Map<java.net.InetSocketAddress,java.lang.String>getVersions()Get all connected memcached servers's version.java.util.Map<java.net.InetSocketAddress,java.lang.String>getVersions(long timeout)longincr(java.lang.String key, long delta)"incr" are used to change data for some item in-place, incrementing it.longincr(java.lang.String key, long delta, long initValue)longincr(java.lang.String key, long delta, long initValue, long timeout)"incr" are used to change data for some item in-place, incrementing it.longincr(java.lang.String key, long delta, long initValue, long timeout, int exp)"incr" are used to change data for some item in-place, incrementing it.voidincrWithNoReply(java.lang.String key, long delta)"incr" are used to change data for some item in-place, incrementing it.voidinvalidateNamespace(java.lang.String ns)Invalidate all namespace under the namespace using the default operation timeout.voidinvalidateNamespace(java.lang.String ns, long opTimeout)Invalidate all items under the namespace.booleanisFailureMode()Returns if client is in failure mode.booleanisSanitizeKeys()booleanisShutdown()private booleanisWindowsPlatform()protected voidlatchWait(Command cmd, long timeout, Session session)protected MemcachedConnectornewConnector(BufferAllocator bufferAllocator, Configuration configuration, MemcachedSessionLocator memcachedSessionLocator, MemcachedSessionComparator memcachedSessionComparator, CommandFactory commandFactory, int poolSize, int maxQueuedNoReplyOperations)protected java.net.InetSocketAddressnewSocketAddress(java.lang.String server, int port)private voidoptimiezeSetReadThreadCount(Configuration conf, int addressCount)booleanprepend(java.lang.String key, java.lang.Object value)booleanprepend(java.lang.String key, java.lang.Object value, long timeout)Prepend value to key's data item in memcached.This method doesn't wait for reply.voidprependWithNoReply(java.lang.String key, java.lang.Object value)Prepend value to key's data item in memcached.This method doesn't wait for reply.private java.lang.StringpreProcessKey(java.lang.String key)private <T> java.util.Map<java.lang.String,T>reduceResult(CommandType cmdType, Transcoder<T> transcoder, java.util.List<Command> commands)private voidregisterMBean()voidremoveServer(java.lang.String hostList)Remove memcached serversvoidremoveServer(java.net.InetSocketAddress address)Remove memcached server with the exact given address.voidremoveStateListener(MemcachedClientStateListener listener)Remove a memcached client listenerbooleanreplace(java.lang.String key, int exp, java.lang.Object value)booleanreplace(java.lang.String key, int exp, java.lang.Object value, long timeout)<T> booleanreplace(java.lang.String key, int exp, T value, Transcoder<T> transcoder)<T> booleanreplace(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout)Replace the key's data item in memcached,success only when the key's data item is exists in memcached.This method will wait for reply from server.voidreplaceWithNoReply(java.lang.String key, int exp, java.lang.Object value)Replace the key's data item in memcached,success only when the key's data item is exists in memcached.This method doesn't wait for reply from server.<T> voidreplaceWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)protected SessionsendCommand(Command cmd)private <T> CommandsendGetMultiCommand(java.util.Collection<java.lang.String> keys, java.util.concurrent.CountDownLatch latch, CommandType cmdType, Transcoder<T> transcoder)private longsendIncrOrDecrCommand(java.lang.String key, long delta, long initValue, CommandType cmdType, boolean noreply, long operationTimeout, int exp)private <T> booleansendStoreCommand(Command command, long timeout)booleanset(java.lang.String key, int exp, java.lang.Object value)booleanset(java.lang.String key, int exp, java.lang.Object value, long timeout)<T> booleanset(java.lang.String key, int exp, T value, Transcoder<T> transcoder)<T> booleanset(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout)Store key-value item to memcachedvoidsetAuthInfoMap(java.util.Map<java.net.InetSocketAddress,AuthInfo> map)Configure auth infovoidsetBufferAllocator(BufferAllocator bufferAllocator)Set the nio's ByteBuffer Allocator,use SimpleBufferAllocator by default.voidsetConnectionPoolSize(int poolSize)In a high concurrent enviroment,you may want to pool memcached clients.But a xmemcached client has to start a reactor thread and some thread pools,if you create too many clients,the cost is very large.voidsetConnectTimeout(long connectTimeout)Set the connect timeout,default is 1 minutesvoidsetEnableHealSession(boolean enableHealSession)If the memcached dump or network error cause connection closed,xmemcached would try to heal the connection.You can disable this behaviour by using this method:
client.setEnableHealSession(false);
The default value is true.voidsetEnableHeartBeat(boolean enableHeartBeat)Whether to enable heart beatvoidsetFailureMode(boolean failureMode)Configure wheather to set client in failure mode.If set it to true,that means you want to configure client in failure mode.voidsetHealSessionInterval(long healConnectionInterval)If the memcached dump or network error cause connection closed,xmemcached would try to heal the connection.The interval between reconnections is 2 seconds by default.voidsetKeyProvider(KeyProvider keyProvider)Set a key provider for pre-processing keys before sending them to memcached.voidsetLoggingLevelVerbosity(java.net.InetSocketAddress address, int level)Set the verbosity level of the memcached's logging output.This method will wait for reply.voidsetLoggingLevelVerbosityWithNoReply(java.net.InetSocketAddress address, int level)Set the verbosity level of the memcached's logging output.This method doesn't wait for reply from server(package private) voidsetMaxQueuedNoReplyOperations(int maxQueuedNoReplyOperations)Set max queued noreply operations numberprivate voidsetMemcachedLoggingLevel(java.net.InetSocketAddress address, int level, boolean noreply)voidsetMergeFactor(int mergeFactor)Set the merge factor,this factor determins how many 'get' commands would be merge to one multi-get command.default is 150voidsetName(java.lang.String name)Set cache instance namevoidsetOpTimeout(long opTimeout)set operation timeout,default is one second.voidsetOptimizeGet(boolean optimizeGet)Enable/Disable merge many get commands to one multi-get command.true is to enable it,false is to disable it.Default is true.Recommend users to enable it.voidsetOptimizeMergeBuffer(boolean optimizeMergeBuffer)Enable/Disable merge many command's buffers to one big buffer fit socket's send buffer size.Default is true.Recommend true.voidsetPrimitiveAsString(boolean primitiveAsString)Store all primitive type as string,defualt is false.voidsetSanitizeKeys(boolean sanitizeKeys)Enables/disables sanitizing keys by URLEncoding.voidsetServerWeight(java.lang.String server, int weight)Set a memcached server's weightvoidsetTimeoutExceptionThreshold(int timeoutExceptionThreshold)Set maximum number of timeout exception for closing connection.You can set it to be a large value to disable this feature.voidsetTranscoder(Transcoder transcoder)set transcodervoidsetWithNoReply(java.lang.String key, int exp, java.lang.Object value)Store key-value item to memcached,doesn't wait for reply<T> voidsetWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)voidshutdown()protected voidshutdown0()For subclass override.private voidstart0()private voidstartConnector()java.util.Map<java.lang.String,java.lang.String>stats(java.net.InetSocketAddress address)java.util.Map<java.lang.String,java.lang.String>stats(java.net.InetSocketAddress address, long timeout)�ョ��瑰������emcached server缁��淇℃�booleantouch(java.lang.String key, int exp)Set a new expiration time for an existing item,using default opTimeout second.booleantouch(java.lang.String key, int exp, long opTimeout)Set a new expiration time for an existing item<T> TwithNamespace(java.lang.String ns, MemcachedClientCallable<T> callable)With the namespae to do something with current memcached client.All operations with memcached client done in callable will be under the namespace.
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
sessionLocator
protected MemcachedSessionLocator sessionLocator
-
sessionComparator
protected MemcachedSessionComparator sessionComparator
-
shutdown
private volatile boolean shutdown
-
connector
protected MemcachedConnector connector
-
transcoder
private Transcoder transcoder
-
sanitizeKeys
private boolean sanitizeKeys
-
memcachedHandler
private MemcachedHandler memcachedHandler
-
commandFactory
protected CommandFactory commandFactory
-
opTimeout
protected long opTimeout
-
connectTimeout
private long connectTimeout
-
connectionPoolSize
protected int connectionPoolSize
-
maxQueuedNoReplyOperations
protected int maxQueuedNoReplyOperations
-
resolveInetAddresses
protected boolean resolveInetAddresses
-
serverOrderCount
protected final java.util.concurrent.atomic.AtomicInteger serverOrderCount
-
authInfoMap
private java.util.Map<java.net.InetSocketAddress,AuthInfo> authInfoMap
-
authInfoStringMap
private java.util.Map<java.lang.String,AuthInfo> authInfoStringMap
-
name
private java.lang.String name
-
failureMode
private boolean failureMode
-
timeoutExceptionThreshold
private int timeoutExceptionThreshold
-
stateListenerAdapters
private final java.util.concurrent.CopyOnWriteArrayList<MemcachedClientStateListenerAdapter> stateListenerAdapters
-
shutdownHookThread
private java.lang.Thread shutdownHookThread
-
isHutdownHookCalled
private volatile boolean isHutdownHookCalled
-
keyProvider
private KeyProvider keyProvider
-
NAMESPACE_LOCAL
public static final java.lang.ThreadLocal<java.lang.String> NAMESPACE_LOCAL
namespace thread local.
-
CONTINUOUS_TIMEOUT_COUNTER
private static final java.lang.String CONTINUOUS_TIMEOUT_COUNTER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XMemcachedClient
public XMemcachedClient(java.lang.String server, int port) throws java.io.IOExceptionXMemcached constructor,default weight is 1- Parameters:
server- �����Pport- ����ㄧ���- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.lang.String host, int port, int weight) throws java.io.IOExceptionXMemcached constructor- Parameters:
host- server hostport- server portweight- server weight- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.net.InetSocketAddress inetSocketAddress, int weight, CommandFactory cmdFactory) throws java.io.IOExceptionXMemcached Constructor.- Parameters:
inetSocketAddress-weight-- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.net.InetSocketAddress inetSocketAddress, int weight) throws java.io.IOException- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.net.InetSocketAddress inetSocketAddress) throws java.io.IOException- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient() throws java.io.IOException- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, java.util.Map<java.net.InetSocketAddress,java.net.InetSocketAddress> addressMap, java.util.List<MemcachedClientStateListener> stateListeners, java.util.Map<java.net.InetSocketAddress,AuthInfo> map, int poolSize, long connectTimeout, java.lang.String name, boolean failureMode, boolean resolveInetAddresses) throws java.io.IOException
XMemcachedClient constructor.Every server's weight is one by default. You should not new client instance by this method, use MemcachedClientBuilder instead.- Parameters:
locator-comparator-allocator-conf-commandFactory-transcoder-addressList-stateListeners-- Throws:
java.io.IOException
-
XMemcachedClient
XMemcachedClient(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, java.util.Map<java.net.InetSocketAddress,java.net.InetSocketAddress> addressMap, int[] weights, java.util.List<MemcachedClientStateListener> stateListeners, java.util.Map<java.net.InetSocketAddress,AuthInfo> infoMap, int poolSize, long connectTimeout, java.lang.String name, boolean failureMode, boolean resolveInetAddresses) throws java.io.IOException
XMemcachedClient constructor.- Parameters:
locator-comparator-allocator-conf-commandFactory-transcoder-addressList-weights-stateListeners- weight array for address list- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.util.List<java.net.InetSocketAddress> addressList) throws java.io.IOExceptionXMemcached Constructor.Every server's weight is one by default.- Parameters:
addressList-- Throws:
java.io.IOException
-
XMemcachedClient
public XMemcachedClient(java.util.List<java.net.InetSocketAddress> addressList, CommandFactory cmdFactory) throws java.io.IOExceptionXMemcached Constructor.Every server's weight is one by default.- Parameters:
cmdFactory- command factoryaddressList- memcached server socket address list.- Throws:
java.io.IOException
-
-
Method Detail
-
setMergeFactor
public final void setMergeFactor(int mergeFactor)
Description copied from interface:MemcachedClientSet the merge factor,this factor determins how many 'get' commands would be merge to one multi-get command.default is 150- Specified by:
setMergeFactorin interfaceMemcachedClient
-
getTimeoutExceptionThreshold
public int getTimeoutExceptionThreshold()
Description copied from interface:MemcachedClientReturns maximum number of timeout exception for closing connection.- Specified by:
getTimeoutExceptionThresholdin interfaceMemcachedClient- Returns:
-
setTimeoutExceptionThreshold
public void setTimeoutExceptionThreshold(int timeoutExceptionThreshold)
Description copied from interface:MemcachedClientSet maximum number of timeout exception for closing connection.You can set it to be a large value to disable this feature.- Specified by:
setTimeoutExceptionThresholdin interfaceMemcachedClient- See Also:
MemcachedClient.DEFAULT_MAX_TIMEOUTEXCEPTION_THRESHOLD
-
withNamespace
public <T> T withNamespace(java.lang.String ns, MemcachedClientCallable<T> callable) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientWith the namespae to do something with current memcached client.All operations with memcached client done in callable will be under the namespace.MemcachedClient.beginWithNamespace(String)andMemcachedClient.endWithNamespace()will called around automatically. For example:memcachedClient.withNamespace(userId,new MemcachedClientCallable
{ public Void call(MemcachedClient client) throws MemcachedException, InterruptedException, TimeoutException{ client.set("username",0,username); client.set("email",0,email); return null; } }); //invalidate all items under the namespace. memcachedClient.invalidateNamespace(userId); - Specified by:
withNamespacein interfaceMemcachedClient- Returns:
- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException- See Also:
MemcachedClient.beginWithNamespace(String),MemcachedClient.endWithNamespace()
-
endWithNamespace
public void endWithNamespace()
Description copied from interface:MemcachedClientRemove current namespace set for this memcached client.It must begin withMemcachedClient.beginWithNamespace(String)method.- Specified by:
endWithNamespacein interfaceMemcachedClient- See Also:
MemcachedClient.beginWithNamespace(String)
-
beginWithNamespace
public void beginWithNamespace(java.lang.String ns)
Description copied from interface:MemcachedClientset current namespace for following operations with memcached client.It must be ended withMemcachedClient.endWithNamespace()method.For example:memcachedClient.beginWithNamespace(userId); try { memcachedClient.set("username", 0, username); memcachedClient.set("email", 0, email); } finally { memcachedClient.endWithNamespace(); }- Specified by:
beginWithNamespacein interfaceMemcachedClient- See Also:
MemcachedClient.endWithNamespace(),MemcachedClient.withNamespace(String, MemcachedClientCallable)
-
getKeyProvider
public KeyProvider getKeyProvider()
-
setKeyProvider
public void setKeyProvider(KeyProvider keyProvider)
Description copied from interface:MemcachedClientSet a key provider for pre-processing keys before sending them to memcached.- Specified by:
setKeyProviderin interfaceMemcachedClient
-
getSessionLocator
public final MemcachedSessionLocator getSessionLocator()
-
getSessionComparator
public final MemcachedSessionComparator getSessionComparator()
-
getCommandFactory
public final CommandFactory getCommandFactory()
-
getName
public java.lang.String getName()
Description copied from interface:XMemcachedClientMBeanReturn the cache instance name- Specified by:
getNamein interfaceMemcachedClient- Specified by:
getNamein interfaceXMemcachedClientMBean- Returns:
-
setName
public void setName(java.lang.String name)
Description copied from interface:MemcachedClientSet cache instance name- Specified by:
setNamein interfaceMemcachedClient
-
getConnectTimeout
public long getConnectTimeout()
Description copied from interface:MemcachedClientGet the connect timeout- Specified by:
getConnectTimeoutin interfaceMemcachedClient
-
setConnectTimeout
public void setConnectTimeout(long connectTimeout)
Description copied from interface:MemcachedClientSet the connect timeout,default is 1 minutes- Specified by:
setConnectTimeoutin interfaceMemcachedClient
-
setEnableHeartBeat
public void setEnableHeartBeat(boolean enableHeartBeat)
Description copied from interface:MemcachedClientWhether to enable heart beat- Specified by:
setEnableHeartBeatin interfaceMemcachedClient- Parameters:
enableHeartBeat- if true,then enable heartbeat,true by default
-
getOpTimeout
public final long getOpTimeout()
get operation timeout setting- Specified by:
getOpTimeoutin interfaceMemcachedClient- Returns:
-
setOpTimeout
public final void setOpTimeout(long opTimeout)
set operation timeout,default is one second.- Specified by:
setOpTimeoutin interfaceMemcachedClient- Parameters:
opTimeout-
-
setHealSessionInterval
public void setHealSessionInterval(long healConnectionInterval)
Description copied from interface:MemcachedClientIf the memcached dump or network error cause connection closed,xmemcached would try to heal the connection.The interval between reconnections is 2 seconds by default. You can change that value by this method.- Specified by:
setHealSessionIntervalin interfaceMemcachedClient- Parameters:
healConnectionInterval- MILLISECONDS
-
getHealSessionInterval
public long getHealSessionInterval()
Description copied from interface:MemcachedClientReturn the default heal session interval in milliseconds- Specified by:
getHealSessionIntervalin interfaceMemcachedClient- Returns:
-
getAuthInfoMap
public java.util.Map<java.net.InetSocketAddress,AuthInfo> getAuthInfoMap()
Description copied from interface:MemcachedClientreturn current all auth info- Specified by:
getAuthInfoMapin interfaceMemcachedClient- Returns:
- Auth info map,key is memcached server address,and value is the auth info for the key.
-
setAuthInfoMap
public void setAuthInfoMap(java.util.Map<java.net.InetSocketAddress,AuthInfo> map)
Description copied from interface:MemcachedClientConfigure auth info- Specified by:
setAuthInfoMapin interfaceMemcachedClient- Parameters:
map- Auth info map,key is memcached server address,and value is the auth info for the key.
-
getAuthInfoStringMap
public java.util.Map<java.lang.String,AuthInfo> getAuthInfoStringMap()
Description copied from interface:MemcachedClientRetruns the AuthInfo for all server strings (hostname:port)- Specified by:
getAuthInfoStringMapin interfaceMemcachedClient- Returns:
- A map of AuthInfos for server strings (hostname:port)
-
getConnector
public final Connector getConnector()
Description copied from interface:MemcachedClientreturn the session manager- Specified by:
getConnectorin interfaceMemcachedClient- Returns:
-
setOptimizeMergeBuffer
public final void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
Description copied from interface:MemcachedClientEnable/Disable merge many command's buffers to one big buffer fit socket's send buffer size.Default is true.Recommend true.- Specified by:
setOptimizeMergeBufferin interfaceMemcachedClient
-
isShutdown
public final boolean isShutdown()
- Specified by:
isShutdownin interfaceMemcachedClient- Returns:
-
gets0
private final <T> GetsResponse<T> gets0(java.lang.String key, byte[] keyBytes, Transcoder<T> transcoder) throws MemcachedException, java.util.concurrent.TimeoutException, java.lang.InterruptedException
- Throws:
MemcachedExceptionjava.util.concurrent.TimeoutExceptionjava.lang.InterruptedException
-
sendCommand
protected final Session sendCommand(Command cmd) throws MemcachedException
- Throws:
MemcachedException
-
newSocketAddress
protected java.net.InetSocketAddress newSocketAddress(java.lang.String server, int port)
-
checkServerPort
private void checkServerPort(java.lang.String server, int port)
-
addServer
public final void addServer(java.lang.String server, int port) throws java.io.IOExceptionDescription copied from interface:MemcachedClientAadd a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)- Specified by:
addServerin interfaceMemcachedClient- Parameters:
server- host stringport- port number- Throws:
java.io.IOException
-
addServer
public final void addServer(java.lang.String server, int port, int weight) throws java.io.IOExceptionadd a memcached server to MemcachedClient- Specified by:
addServerin interfaceMemcachedClient- Parameters:
server-port-weight-- Throws:
java.io.IOException
-
addServer
public final void addServer(java.net.InetSocketAddress inetSocketAddress) throws java.io.IOExceptionDescription copied from interface:MemcachedClientAdd a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)- Specified by:
addServerin interfaceMemcachedClient- Parameters:
inetSocketAddress- memcached server's socket address- Throws:
java.io.IOException
-
addServer
public final void addServer(java.net.InetSocketAddress inetSocketAddress, int weight) throws java.io.IOException- Specified by:
addServerin interfaceMemcachedClient- Throws:
java.io.IOException
-
addServer
public final void addServer(java.lang.String hostList) throws java.io.IOExceptionDescription copied from interface:XMemcachedClientMBeanAdd memcached servers- Specified by:
addServerin interfaceMemcachedClient- Specified by:
addServerin interfaceXMemcachedClientMBean- Throws:
java.io.IOException
-
addOneServerWithWeight
public void addOneServerWithWeight(java.lang.String server, int weight) throws java.io.IOExceptionDescription copied from interface:XMemcachedClientMBeanAdd a memcached server- Specified by:
addOneServerWithWeightin interfaceXMemcachedClientMBean- Parameters:
server- a String in the form of "[host1]:[port1],[host2]:[port2]"weight- server's weight- Throws:
java.io.IOException
-
getServersDescription
public final java.util.List<java.lang.String> getServersDescription()
Description copied from interface:XMemcachedClientMBeanGet all connected memcached servers- Specified by:
getServersDescriptionin interfaceMemcachedClient- Specified by:
getServersDescriptionin interfaceXMemcachedClientMBean- Returns:
- a list of string,every string is in the form of "[host1]:[port1](weight=num1) [host2]:[port2](weight=num1)"
-
setServerWeight
public final void setServerWeight(java.lang.String server, int weight)Description copied from interface:XMemcachedClientMBeanSet a memcached server's weight- Specified by:
setServerWeightin interfaceXMemcachedClientMBean
-
removeServer
public final void removeServer(java.lang.String hostList)
Description copied from interface:XMemcachedClientMBeanRemove memcached servers- Specified by:
removeServerin interfaceMemcachedClient- Specified by:
removeServerin interfaceXMemcachedClientMBean
-
removeServer
public void removeServer(java.net.InetSocketAddress address)
Description copied from interface:MemcachedClientRemove memcached server with the exact given address.- Specified by:
removeServerin interfaceMemcachedClient- Parameters:
address- Resolved server address
-
connect
protected void connect(InetSocketAddressWrapper inetSocketAddressWrapper) throws java.io.IOException
- Throws:
java.io.IOException
-
fetch0
private final <T> java.lang.Object fetch0(java.lang.String key, byte[] keyBytes, CommandType cmdType, long timeout, Transcoder<T> transcoder) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, MemcachedException- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionMemcachedException
-
start0
private final void start0() throws java.io.IOException- Throws:
java.io.IOException
-
startConnector
private final void startConnector() throws java.io.IOException- Throws:
java.io.IOException
-
setMaxQueuedNoReplyOperations
void setMaxQueuedNoReplyOperations(int maxQueuedNoReplyOperations)
Set max queued noreply operations number- Parameters:
maxQueuedNoReplyOperations-
-
buildConnector
private void buildConnector(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator bufferAllocator, Configuration configuration, java.util.Map<SocketOption,java.lang.Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder)
-
newConnector
protected MemcachedConnector newConnector(BufferAllocator bufferAllocator, Configuration configuration, MemcachedSessionLocator memcachedSessionLocator, MemcachedSessionComparator memcachedSessionComparator, CommandFactory commandFactory, int poolSize, int maxQueuedNoReplyOperations)
-
registerMBean
private final void registerMBean()
-
setOptimizeGet
public void setOptimizeGet(boolean optimizeGet)
Description copied from interface:MemcachedClientEnable/Disable merge many get commands to one multi-get command.true is to enable it,false is to disable it.Default is true.Recommend users to enable it.- Specified by:
setOptimizeGetin interfaceMemcachedClient
-
setBufferAllocator
public final void setBufferAllocator(BufferAllocator bufferAllocator)
Description copied from interface:MemcachedClientSet the nio's ByteBuffer Allocator,use SimpleBufferAllocator by default.- Specified by:
setBufferAllocatorin interfaceMemcachedClient
-
optimiezeSetReadThreadCount
private final void optimiezeSetReadThreadCount(Configuration conf, int addressCount)
-
isWindowsPlatform
private final boolean isWindowsPlatform()
-
get
public final <T> T get(java.lang.String key, long timeout, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientGet value by key- Specified by:
getin interfaceMemcachedClient- Parameters:
key- Keytimeout- Operation timeout,if the method is not returned in this time,throw TimeoutExceptiontranscoder- The value's transcoder- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
get
public final <T> T get(java.lang.String key, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
get
public final <T> T get(java.lang.String key, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
get
public final <T> T get(java.lang.String key) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
get0
private <T> java.lang.Object get0(java.lang.String key, long timeout, CommandType cmdType, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
gets
public final <T> GetsResponse<T> gets(java.lang.String key, long timeout, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
Description copied from interface:MemcachedClientJust like get,But it return a GetsResponse,include cas value for cas update.- Specified by:
getsin interfaceMemcachedClient- Parameters:
key- keytimeout- operation timeout- Returns:
- GetsResponse
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
gets
public final <T> GetsResponse<T> gets(java.lang.String key) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(String, long, Transcoder)
-
gets
public final <T> GetsResponse<T> gets(java.lang.String key, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(String, long, Transcoder)
-
gets
public final <T> GetsResponse<T> gets(java.lang.String key, Transcoder transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(String, long, Transcoder)
-
get
public final <T> java.util.Map<java.lang.String,T> get(java.util.Collection<java.lang.String> keyCollections, long timeout, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientBulk get items- Specified by:
getin interfaceMemcachedClient- Parameters:
keyCollections- key collectiontimeout- opTimeouttranscoder- Value transcoder- Returns:
- Exists items map
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
get
public final <T> java.util.Map<java.lang.String,T> get(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.get(Collection, long, Transcoder)
-
get
public final <T> java.util.Map<java.lang.String,T> get(java.util.Collection<java.lang.String> keyCollections) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.get(Collection, long, Transcoder)
-
get
public final <T> java.util.Map<java.lang.String,T> get(java.util.Collection<java.lang.String> keyCollections, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.get(Collection, long, Transcoder)
-
gets
public final <T> java.util.Map<java.lang.String,GetsResponse<T>> gets(java.util.Collection<java.lang.String> keyCollections, long timeout, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
Description copied from interface:MemcachedClientBulk gets items- Specified by:
getsin interfaceMemcachedClient- Parameters:
keyCollections- key collectiontimeout- Operation timeouttranscoder- Value transcoder- Returns:
- Exists GetsResponse map
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
GetsResponse
-
gets
public final <T> java.util.Map<java.lang.String,GetsResponse<T>> gets(java.util.Collection<java.lang.String> keyCollections) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(Collection, long, Transcoder)
-
gets
public final <T> java.util.Map<java.lang.String,GetsResponse<T>> gets(java.util.Collection<java.lang.String> keyCollections, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(Collection, long, Transcoder)
-
gets
public final <T> java.util.Map<java.lang.String,GetsResponse<T>> gets(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException
- Specified by:
getsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.gets(Collection, long, Transcoder)
-
getMulti0
private final <T> java.util.Map<java.lang.String,T> getMulti0(java.util.Collection<java.lang.String> keys, long timeout, CommandType cmdType, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
reduceResult
private <T> java.util.Map<java.lang.String,T> reduceResult(CommandType cmdType, Transcoder<T> transcoder, java.util.List<Command> commands) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
catalogKeys
private final java.util.Collection<java.util.List<java.lang.String>> catalogKeys(java.util.Collection<java.lang.String> keyCollections)
Hash key to servers- Parameters:
keyCollections-- Returns:
-
sendGetMultiCommand
private final <T> Command sendGetMultiCommand(java.util.Collection<java.lang.String> keys, java.util.concurrent.CountDownLatch latch, CommandType cmdType, Transcoder<T> transcoder) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, MemcachedException
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionMemcachedException
-
set
public final <T> boolean set(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientStore key-value item to memcached- Specified by:
setin interfaceMemcachedClient- Parameters:
key- stored keyexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.value- stored datatranscoder- transocdertimeout- operation timeout,in milliseconds- Returns:
- boolean result
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
setWithNoReply
public void setWithNoReply(java.lang.String key, int exp, java.lang.Object value) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientStore key-value item to memcached,doesn't wait for reply- Specified by:
setWithNoReplyin interfaceMemcachedClient- Parameters:
key- stored keyexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.value- stored data- Throws:
java.lang.InterruptedExceptionMemcachedException
-
setWithNoReply
public <T> void setWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.lang.InterruptedException, MemcachedException- Specified by:
setWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.setWithNoReply(String, int, Object, Transcoder)
-
checkStoreArguments
private final <T> byte[] checkStoreArguments(java.lang.String key, int exp, T value)
-
set
public final boolean set(java.lang.String key, int exp, java.lang.Object value) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
setin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.set(String, int, Object, Transcoder, long)
-
set
public final boolean set(java.lang.String key, int exp, java.lang.Object value, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
setin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.set(String, int, Object, Transcoder, long)
-
set
public final <T> boolean set(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
setin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.set(String, int, Object, Transcoder, long)
-
add
public final <T> boolean add(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientAdd key-value item to memcached, success only when the key is not exists in memcached.- Specified by:
addin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- boolean result
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
add0
private <T> boolean add0(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, MemcachedException- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionMemcachedException
-
add
public final boolean add(java.lang.String key, int exp, java.lang.Object value) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
addin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.add(String, int, Object, Transcoder, long)
-
add
public final boolean add(java.lang.String key, int exp, java.lang.Object value, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
addin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.add(String, int, Object, Transcoder, long)
-
add
public final <T> boolean add(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
addin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.add(String, int, Object, Transcoder, long)
-
addWithNoReply
public void addWithNoReply(java.lang.String key, int exp, java.lang.Object value) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientAdd key-value item to memcached, success only when the key is not exists in memcached.This method doesn't wait for reply.- Specified by:
addWithNoReplyin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Throws:
java.lang.InterruptedExceptionMemcachedException
-
addWithNoReply
public <T> void addWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.lang.InterruptedException, MemcachedException- Specified by:
addWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.addWithNoReply(String, int, Object, Transcoder)
-
replaceWithNoReply
public void replaceWithNoReply(java.lang.String key, int exp, java.lang.Object value) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientReplace the key's data item in memcached,success only when the key's data item is exists in memcached.This method doesn't wait for reply from server.- Specified by:
replaceWithNoReplyin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Throws:
java.lang.InterruptedExceptionMemcachedException
-
replaceWithNoReply
public <T> void replaceWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.lang.InterruptedException, MemcachedException- Specified by:
replaceWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.replaceWithNoReply(String, int, Object, Transcoder)
-
replace
public final <T> boolean replace(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientReplace the key's data item in memcached,success only when the key's data item is exists in memcached.This method will wait for reply from server.- Specified by:
replacein interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- boolean result
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
replace
public final boolean replace(java.lang.String key, int exp, java.lang.Object value) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
replacein interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.replace(String, int, Object, Transcoder, long)
-
replace
public final boolean replace(java.lang.String key, int exp, java.lang.Object value, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
replacein interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.replace(String, int, Object, Transcoder, long)
-
replace
public final <T> boolean replace(java.lang.String key, int exp, T value, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
replacein interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.replace(String, int, Object, Transcoder, long)
-
append
public final boolean append(java.lang.String key, java.lang.Object value) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
appendin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.append(String, Object, long)
-
append
public final boolean append(java.lang.String key, java.lang.Object value, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientAppend value to key's data item,this method will wait for reply- Specified by:
appendin interfaceMemcachedClient- Returns:
- boolean result
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
appendWithNoReply
public void appendWithNoReply(java.lang.String key, java.lang.Object value) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientAppend value to key's data item,this method doesn't wait for reply.- Specified by:
appendWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
prepend
public final boolean prepend(java.lang.String key, java.lang.Object value) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
prependin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.prepend(String, Object, long)
-
prepend
public final boolean prepend(java.lang.String key, java.lang.Object value, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientPrepend value to key's data item in memcached.This method doesn't wait for reply.- Specified by:
prependin interfaceMemcachedClient- Returns:
- boolean result
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
prependWithNoReply
public void prependWithNoReply(java.lang.String key, java.lang.Object value) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientPrepend value to key's data item in memcached.This method doesn't wait for reply.- Specified by:
prependWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
cas
public final boolean cas(java.lang.String key, int exp, java.lang.Object value, long cas) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, Object, Transcoder, long, long)
-
cas
public final <T> boolean cas(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout, long cas) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientCas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."- Specified by:
casin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
cas
public final boolean cas(java.lang.String key, int exp, java.lang.Object value, long timeout, long cas) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, Object, Transcoder, long, long)
-
cas
public final <T> boolean cas(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long cas) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, Object, Transcoder, long, long)
-
cas0
private final <T> boolean cas0(java.lang.String key, int exp, GetsResponse<T> getsResponse, CASOperation<T> operation, Transcoder<T> transcoder, byte[] keyBytes, boolean noreply) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
cas
public final <T> boolean cas(java.lang.String key, int exp, CASOperation<T> operation, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientCas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."- Specified by:
casin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.operation- CASOperationtranscoder- object transcoder- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
cas
public final <T> boolean cas(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation, Transcoder<T> transcoder) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientcas is a check and set operation which means "store this data but only if no one else has updated since I last fetched it."- Specified by:
casin interfaceMemcachedClientexp- An expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.getsReponse- gets method's resultoperation- CASOperation- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
cas
public final <T> boolean cas(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, GetsResponse, CASOperation, Transcoder)
-
casWithNoReply
public <T> void casWithNoReply(java.lang.String key, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casWithNoReplyin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.casWithNoReply(String, int, GetsResponse, CASOperation)
-
casWithNoReply
public <T> void casWithNoReply(java.lang.String key, GetsResponse<T> getsResponse, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casWithNoReplyin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
casWithNoReply
public <T> void casWithNoReply(java.lang.String key, int exp, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casWithNoReplyin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.casWithNoReply(String, int, GetsResponse, CASOperation)
-
casWithNoReply
public <T> void casWithNoReply(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientcas noreply- Specified by:
casWithNoReplyin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
cas
public final <T> boolean cas(java.lang.String key, GetsResponse<T> getsReponse, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, GetsResponse, CASOperation, Transcoder)
-
cas
public final <T> boolean cas(java.lang.String key, int exp, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, GetsResponse, CASOperation, Transcoder)
-
cas
public final <T> boolean cas(java.lang.String key, CASOperation<T> operation) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
casin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.cas(String, int, GetsResponse, CASOperation, Transcoder)
-
delete
public final boolean delete(java.lang.String key, int time) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientDelete key's data item from memcached.It it is not exists,return false. time is 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. Note: This method is deprecated,because memcached 1.4.0 remove the optional argument "time".You can still use this method on old version,but is not recommended.- Specified by:
deletein interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedExceptionjava.util.concurrent.TimeoutException
-
delete
public boolean delete(java.lang.String key, long opTimeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientDelete key's date item from memcached- Specified by:
deletein interfaceMemcachedClientopTimeout- Operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
delete
public boolean delete(java.lang.String key, long cas, long opTimeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientDelete key's date item from memcached only if its cas value is the same as what was read.- Specified by:
deletein interfaceMemcachedClientopTimeout- Operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
deleteWithNoReply
public final void deleteWithNoReply(java.lang.String key, int time) throws java.lang.InterruptedException, MemcachedExceptionDelete key's data item from memcached.This method doesn't wait for reply- Specified by:
deleteWithNoReplyin interfaceMemcachedClient- Parameters:
key-time-- Throws:
java.lang.InterruptedExceptionMemcachedException
-
deleteWithNoReply
public final void deleteWithNoReply(java.lang.String key) throws java.lang.InterruptedException, MemcachedException- Specified by:
deleteWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
delete0
private boolean delete0(java.lang.String key, int time, long cas, boolean noreply, long opTimeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
checkException
protected void checkException(Command command) throws MemcachedException
- Throws:
MemcachedException
-
touch
public boolean touch(java.lang.String key, int exp, long opTimeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientSet a new expiration time for an existing item- Specified by:
touchin interfaceMemcachedClient- Parameters:
key- item's keyexp- New expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.opTimeout- operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
touch
public boolean touch(java.lang.String key, int exp) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientSet a new expiration time for an existing item,using default opTimeout second.- Specified by:
touchin interfaceMemcachedClient- Parameters:
key- item's keyexp- New expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getAndTouch
public <T> T getAndTouch(java.lang.String key, int newExp, long opTimeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientGet item and set a new expiration time for it- Specified by:
getAndTouchin interfaceMemcachedClient- Parameters:
key- item's keynewExp- New expiration time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.opTimeout- operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getAndTouch
public <T> T getAndTouch(java.lang.String key, int newExp) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientGet item and set a new expiration time for it,using default opTimeout- Specified by:
getAndTouchin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
incr
public final long incr(java.lang.String key, long delta) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"incr" are used to change data for some item in-place, incrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for incr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
incrin interfaceMemcachedClient- Returns:
- the new value of the item's data, after the increment operation was carried out.
- Throws:
java.lang.InterruptedExceptionMemcachedExceptionjava.util.concurrent.TimeoutException
-
incr
public long incr(java.lang.String key, long delta, long initValue) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
incrin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
incr
public long incr(java.lang.String key, long delta, long initValue, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"incr" are used to change data for some item in-place, incrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for incr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
incrin interfaceMemcachedClient- Parameters:
key- keyinitValue- initValue if the data is not exists.timeout- operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
incr
public long incr(java.lang.String key, long delta, long initValue, long timeout, int exp) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"incr" are used to change data for some item in-place, incrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for incr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
incrin interfaceMemcachedClient- Parameters:
key- keydelta- increment deltainitValue- the initial value to be added when value is not foundtimeout- operation timeoutexp- the initial vlaue expire time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
incrWithNoReply
public final void incrWithNoReply(java.lang.String key, long delta) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"incr" are used to change data for some item in-place, incrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for incr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
incrWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
decrWithNoReply
public final void decrWithNoReply(java.lang.String key, long delta) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"decr" are used to change data for some item in-place, decrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for decr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
decrWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
decr
public final long decr(java.lang.String key, long delta) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"decr" are used to change data for some item in-place, decrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for decr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
decrin interfaceMemcachedClient- Returns:
- the new value of the item's data, after the decrement operation was carried out.
- Throws:
java.lang.InterruptedExceptionMemcachedExceptionjava.util.concurrent.TimeoutException
-
decr
public long decr(java.lang.String key, long delta, long initValue) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
decrin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException- See Also:
MemcachedClient.decr(java.lang.String,long)
-
decr
public long decr(java.lang.String key, long delta, long initValue, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"decr" are used to change data for some item in-place, decrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for decr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
decrin interfaceMemcachedClient- Parameters:
key- The keyinitValue- The initial value if the data is not exists.timeout- Operation timeout- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
decr
public long decr(java.lang.String key, long delta, long initValue, long timeout, int exp) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClient"incr" are used to change data for some item in-place, incrementing it. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Also, the item must already exist for incr to work; these commands won't pretend that a non-existent key exists with value 0; instead, it will fail.This method doesn't wait for reply.- Specified by:
decrin interfaceMemcachedClientinitValue- the initial value to be added when value is not foundexp- the initial vlaue expire time, in seconds. Can be up to 30 days. After 30 days, is treated as a unix timestamp of an exact date.- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
flushAll
public final void flushAll() throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientMake All connected memcached's data item invalid- Specified by:
flushAllin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
flushAllWithNoReply
public void flushAllWithNoReply() throws java.lang.InterruptedException, MemcachedException- Specified by:
flushAllWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
flushAllWithNoReply
public void flushAllWithNoReply(int exptime) throws java.lang.InterruptedException, MemcachedException- Specified by:
flushAllWithNoReplyin interfaceMemcachedClient- Throws:
java.lang.InterruptedExceptionMemcachedException
-
flushAllWithNoReply
public void flushAllWithNoReply(java.net.InetSocketAddress address) throws MemcachedException, java.lang.InterruptedException- Specified by:
flushAllWithNoReplyin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedException
-
flushAllWithNoReply
public void flushAllWithNoReply(java.net.InetSocketAddress address, int exptime) throws MemcachedException, java.lang.InterruptedException- Specified by:
flushAllWithNoReplyin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedException
-
flushAll
public final void flushAll(int exptime, long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
flushAllin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
flushAll
public final void flushAll(long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientMake All connected memcached's data item invalid- Specified by:
flushAllin interfaceMemcachedClient- Parameters:
timeout- operation timeout- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
flushAllMemcachedServers
private void flushAllMemcachedServers(long timeout, boolean noreply, int exptime) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
setLoggingLevelVerbosity
public void setLoggingLevelVerbosity(java.net.InetSocketAddress address, int level) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientSet the verbosity level of the memcached's logging output.This method will wait for reply.- Specified by:
setLoggingLevelVerbosityin interfaceMemcachedClientlevel- logging level- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
setMemcachedLoggingLevel
private void setMemcachedLoggingLevel(java.net.InetSocketAddress address, int level, boolean noreply) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
setLoggingLevelVerbosityWithNoReply
public void setLoggingLevelVerbosityWithNoReply(java.net.InetSocketAddress address, int level) throws java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientSet the verbosity level of the memcached's logging output.This method doesn't wait for reply from server- Specified by:
setLoggingLevelVerbosityWithNoReplyin interfaceMemcachedClient- Parameters:
address- memcached server addresslevel- logging level- Throws:
java.lang.InterruptedExceptionMemcachedException
-
flushAll
public final void flushAll(java.net.InetSocketAddress address) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientInvalidate all existing items immediately- Specified by:
flushAllin interfaceMemcachedClient- Parameters:
address- Target memcached server- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
flushAll
public final void flushAll(java.net.InetSocketAddress address, long timeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Specified by:
flushAllin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
flushAll
public final void flushAll(java.net.InetSocketAddress address, long timeout, int exptime) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Specified by:
flushAllin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
flushSpecialMemcachedServer
private void flushSpecialMemcachedServer(java.net.InetSocketAddress address, long timeout, boolean noreply, int exptime) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
flushAll
public final void flushAll(java.lang.String host) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientThis method is deprecated,please use flushAll(InetSocketAddress) instead.- Specified by:
flushAllin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
stats
public final java.util.Map<java.lang.String,java.lang.String> stats(java.net.InetSocketAddress address) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Specified by:
statsin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
stats
public final java.util.Map<java.lang.String,java.lang.String> stats(java.net.InetSocketAddress address, long timeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClient�ョ��瑰������emcached server缁��淇℃�- Specified by:
statsin interfaceMemcachedClient- Parameters:
address- ����板�timeout- ���瓒��- Returns:
- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getStats
public final java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStats() throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Specified by:
getStatsin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getStatsByItem
public final java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStatsByItem(java.lang.String itemName) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientGet special item stats. "stats items" for example- Specified by:
getStatsByItemin interfaceMemcachedClient- Returns:
- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getStatsByItem
public final java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStatsByItem(java.lang.String itemName, long timeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Specified by:
getStatsByItemin interfaceMemcachedClient- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getVersions
public final java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions() throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionDescription copied from interface:MemcachedClientGet all connected memcached servers's version.- Specified by:
getVersionsin interfaceMemcachedClient- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getVersions
public final java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions(long timeout) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
getVersionsin interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getStats
public java.util.Map<java.net.InetSocketAddress,java.util.Map<java.lang.String,java.lang.String>> getStats(long timeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientGet stats from all memcached servers- Specified by:
getStatsin interfaceMemcachedClient- Returns:
- server->item->value map
- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
shutdown0
protected void shutdown0()
For subclass override.
-
shutdown
public final void shutdown() throws java.io.IOException- Specified by:
shutdownin interfaceMemcachedClient- Throws:
java.io.IOException
-
sendIncrOrDecrCommand
private long sendIncrOrDecrCommand(java.lang.String key, long delta, long initValue, CommandType cmdType, boolean noreply, long operationTimeout, int exp) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, MemcachedException- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionMemcachedException
-
setConnectionPoolSize
public void setConnectionPoolSize(int poolSize)
Description copied from interface:MemcachedClientIn a high concurrent enviroment,you may want to pool memcached clients.But a xmemcached client has to start a reactor thread and some thread pools,if you create too many clients,the cost is very large. Xmemcached supports connection pool instreadof client pool.you can create more connections to one or more memcached servers,and these connections share the same reactor and thread pools,it will reduce the cost of system.- Specified by:
setConnectionPoolSizein interfaceMemcachedClient- Parameters:
poolSize- pool size,default is one,every memcached has only one connection.
-
delete
public final boolean delete(java.lang.String key) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedException- Specified by:
deletein interfaceMemcachedClient- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getTranscoder
public final Transcoder getTranscoder()
Description copied from interface:MemcachedClientreturn default transcoder,default is SerializingTranscoder- Specified by:
getTranscoderin interfaceMemcachedClient- Returns:
-
setTranscoder
public final void setTranscoder(Transcoder transcoder)
Description copied from interface:MemcachedClientset transcoder- Specified by:
setTranscoderin interfaceMemcachedClient
-
sendStoreCommand
private final <T> boolean sendStoreCommand(Command command, long timeout) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, MemcachedException
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionMemcachedException
-
latchWait
protected void latchWait(Command cmd, long timeout, Session session) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getContinuousTimeoutCounter
private java.util.concurrent.atomic.AtomicInteger getContinuousTimeoutCounter(Session session)
-
getAvaliableServers
@Deprecated public final java.util.Collection<java.net.InetSocketAddress> getAvaliableServers()
Deprecated.Use getAvailableServers() instead- Specified by:
getAvaliableServersin interfaceMemcachedClient- Returns:
- See Also:
MemcachedClient.getAvailableServers()
-
getAvailableServers
public java.util.Collection<java.net.InetSocketAddress> getAvailableServers()
Description copied from interface:MemcachedClientReturns available memcached servers list.- Specified by:
getAvailableServersin interfaceMemcachedClient- Returns:
- A available server collection
-
getConnectionSizeBySocketAddress
public final int getConnectionSizeBySocketAddress(java.net.InetSocketAddress address)
-
addStateListener
public void addStateListener(MemcachedClientStateListener listener)
Description copied from interface:MemcachedClientAdd a memcached client listener- Specified by:
addStateListenerin interfaceMemcachedClient
-
getStateListeners
public java.util.Collection<MemcachedClientStateListener> getStateListeners()
Description copied from interface:MemcachedClientGet all current state listeners- Specified by:
getStateListenersin interfaceMemcachedClient- Returns:
-
setPrimitiveAsString
public void setPrimitiveAsString(boolean primitiveAsString)
Description copied from interface:MemcachedClientStore all primitive type as string,defualt is false.- Specified by:
setPrimitiveAsStringin interfaceMemcachedClient
-
removeStateListener
public void removeStateListener(MemcachedClientStateListener listener)
Description copied from interface:MemcachedClientRemove a memcached client listener- Specified by:
removeStateListenerin interfaceMemcachedClient
-
getProtocol
public Protocol getProtocol()
- Specified by:
getProtocolin interfaceMemcachedClient
-
isSanitizeKeys
public boolean isSanitizeKeys()
- Specified by:
isSanitizeKeysin interfaceMemcachedClient
-
setSanitizeKeys
public void setSanitizeKeys(boolean sanitizeKeys)
Description copied from interface:MemcachedClientEnables/disables sanitizing keys by URLEncoding.- Specified by:
setSanitizeKeysin interfaceMemcachedClient- Parameters:
sanitizeKeys- if true, then URLEncode all keys
-
decodeKey
private java.lang.String decodeKey(java.lang.String key) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutException- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
preProcessKey
private java.lang.String preProcessKey(java.lang.String key) throws MemcachedException, java.lang.InterruptedException- Throws:
MemcachedExceptionjava.lang.InterruptedException
-
invalidateNamespace
public void invalidateNamespace(java.lang.String ns, long opTimeout) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientInvalidate all items under the namespace.- Specified by:
invalidateNamespacein interfaceMemcachedClient- Parameters:
ns- the namespaceopTimeout- operation timeout in milliseconds.- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
invalidateNamespace
public void invalidateNamespace(java.lang.String ns) throws MemcachedException, java.lang.InterruptedException, java.util.concurrent.TimeoutExceptionDescription copied from interface:MemcachedClientInvalidate all namespace under the namespace using the default operation timeout.- Specified by:
invalidateNamespacein interfaceMemcachedClient- Parameters:
ns- the namespace- Throws:
MemcachedExceptionjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
getNamespace
public java.lang.String getNamespace(java.lang.String ns) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException, MemcachedExceptionReturns the real namespace of ns.- Parameters:
ns-- Returns:
- Throws:
java.util.concurrent.TimeoutExceptionjava.lang.InterruptedExceptionMemcachedException
-
getNSKey
private java.lang.String getNSKey(java.lang.String ns)
-
getCounter
public Counter getCounter(java.lang.String key, long initialValue)
Description copied from interface:MemcachedClientGet counter for key,and if the key's value is not set,then set it with initial value.- Specified by:
getCounterin interfaceMemcachedClient- Returns:
-
getCounter
public Counter getCounter(java.lang.String key)
Description copied from interface:MemcachedClientGet counter for key,and if the key's value is not set,then set it with 0.- Specified by:
getCounterin interfaceMemcachedClient- Returns:
-
getKeyIterator
@Deprecated public KeyIterator getKeyIterator(java.net.InetSocketAddress address) throws MemcachedException, java.util.concurrent.TimeoutException, java.lang.InterruptedException
Deprecated.memcached 1.6.x will remove cachedump stats command,so this method will be removed in the futureDescription copied from interface:MemcachedClientGet key iterator for special memcached server.You must known that the iterator is a snapshot for memcached all keys,it is not real-time.The 'stats cachedump" has length limitation,so iterator could not visit all keys if you have many keys.Your application should not be dependent on this feature.- Specified by:
getKeyIteratorin interfaceMemcachedClient- Returns:
- Throws:
MemcachedExceptionjava.util.concurrent.TimeoutExceptionjava.lang.InterruptedException
-
setEnableHealSession
public void setEnableHealSession(boolean enableHealSession)
Description copied from interface:MemcachedClientIf the memcached dump or network error cause connection closed,xmemcached would try to heal the connection.You can disable this behaviour by using this method:
client.setEnableHealSession(false);
The default value is true.- Specified by:
setEnableHealSessionin interfaceMemcachedClient
-
setFailureMode
public void setFailureMode(boolean failureMode)
Description copied from interface:MemcachedClientConfigure wheather to set client in failure mode.If set it to true,that means you want to configure client in failure mode. Failure mode is that when a memcached server is down,it would not taken from the server list but marked as unavailable,and then further requests to this server will be transformed to standby node if configured or throw an exception until it comes back up.- Specified by:
setFailureModein interfaceMemcachedClient- Parameters:
failureMode- true is to configure client in failure mode.
-
isFailureMode
public boolean isFailureMode()
Description copied from interface:MemcachedClientReturns if client is in failure mode.- Specified by:
isFailureModein interfaceMemcachedClient- Returns:
-
getReconnectRequestQueue
public java.util.Queue<ReconnectRequest> getReconnectRequestQueue()
Description copied from interface:MemcachedClientReturns reconnecting task queue,the queue is thread-safe and 'weakly consistent',but maybe you should not modify it at all.- Specified by:
getReconnectRequestQueuein interfaceMemcachedClient- Returns:
- The reconnecting task queue,if the client has not been started,returns null.
-
-