net.rubyeye.xmemcached
Interface MemcachedClient

All Known Implementing Classes:
XMemcachedClient

public interface MemcachedClient

The memcached client's interface

Author:
dennis

Field Summary
static int DEFAULT_CONNECT_TIMEOUT
          Default connect timeout,1 minutes
static int DEFAULT_CONNECTION_POOL_SIZE
          With java nio,there is only one connection to a memcached.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.
static long DEFAULT_OP_TIMEOUT
          Default operation timeout,if the operation is not returned in 1 second,throw TimeoutException
static int DEFAULT_READ_THREAD_COUNT
          Default thread number for reading nio's receive buffer and dispatch commands.Recommend users to set it equal or less to the memcached server's number on linux platform,keep default on windows.Default is 0.
static int DEFAULT_SESSION_IDLE_TIMEOUT
          Default session idle timeout,if session is idle,xmemcached will do a heartbeat action to check if connection is alive.
static int DEFAULT_SESSION_READ_BUFF_SIZE
          Default session read buffer size,16k
static boolean DEFAULT_TCP_KEEPLIVE
          Default TCP keeplive option,which is true
static boolean DEFAULT_TCP_NO_DELAY
          Disable Nagle algorithm by default
static int DEFAULT_TCP_RECV_BUFF_SIZE
          Default socket's receive buffer size,16k
static int DEFAULT_TCP_SEND_BUFF_SIZE
          Default socket's send buffer size,8k
 
Method Summary
 boolean add(java.lang.String key, int exp, java.lang.Object value)
           
 boolean add(java.lang.String key, int exp, java.lang.Object value, long timeout)
           
<T> boolean
add(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
<T> boolean
add(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.
 void addServer(java.net.InetSocketAddress inetSocketAddress)
          Add a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)
 void addServer(java.net.InetSocketAddress inetSocketAddress, int weight)
           
 void addServer(java.lang.String hostList)
          Add many memcached servers.You can call this method through JMX or program
 void addServer(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)
 void addServer(java.lang.String server, int port, int weight)
          add a memcached server to MemcachedClient
 void addStateListener(MemcachedClientStateListener listener)
          Add a memcached client listener
 void addWithNoReply(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> void
addWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
 boolean append(java.lang.String key, java.lang.Object value)
           
 boolean append(java.lang.String key, java.lang.Object value, long timeout)
          Append value to key's data item,this method will wait for reply
 void appendWithNoReply(java.lang.String key, java.lang.Object value)
          Append value to key's data item,this method doesn't wait for reply.
<T> boolean
cas(java.lang.String key, CASOperation<T> operation)
           
<T> boolean
cas(java.lang.String key, GetsResponse<T> getsResponse, CASOperation<T> operation)
           
<T> boolean
cas(java.lang.String key, int exp, CASOperation<T> operation)
           
<T> boolean
cas(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> boolean
cas(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation)
           
<T> boolean
cas(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."
 boolean cas(java.lang.String key, int exp, java.lang.Object value, long cas)
           
 boolean cas(java.lang.String key, int exp, java.lang.Object value, long timeout, long cas)
           
<T> boolean
cas(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long cas)
           
<T> boolean
cas(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> void
casWithNoReply(java.lang.String key, CASOperation<T> operation)
           
<T> void
casWithNoReply(java.lang.String key, GetsResponse<T> getsResponse, CASOperation<T> operation)
           
<T> void
casWithNoReply(java.lang.String key, int exp, CASOperation<T> operation)
           
<T> void
casWithNoReply(java.lang.String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation)
           
 long decr(java.lang.String key, long delta)
          "decr" are used to change data for some item in-place, decrementing it.
 long decr(java.lang.String key, long delta, long initValue)
           
 long decr(java.lang.String key, long delta, long initValue, long timeout)
          "decr" are used to change data for some item in-place, decrementing it.
 long decr(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.
 void decrWithNoReply(java.lang.String key, long delta)
          "decr" are used to change data for some item in-place, decrementing it.
 boolean delete(java.lang.String key)
           
 boolean delete(java.lang.String key, int time)
          Deprecated. 
 void deleteWithNoReply(java.lang.String key)
           
 void deleteWithNoReply(java.lang.String key, int time)
          Deprecated. 
 void flushAll()
          Make All connected memcached's data item invalid
 void flushAll(java.net.InetSocketAddress address)
          Invalidate all existing items immediately
 void flushAll(java.net.InetSocketAddress address, long timeout)
           
 void flushAll(java.net.InetSocketAddress address, long timeout, int exptime)
           
 void flushAll(int exptime, long timeout)
           
 void flushAll(long timeout)
          Make All connected memcached's data item invalid
 void flushAll(java.lang.String host)
          Deprecated.  
 void flushAllWithNoReply()
           
 void flushAllWithNoReply(java.net.InetSocketAddress address)
           
 void flushAllWithNoReply(java.net.InetSocketAddress address, int exptime)
           
 void flushAllWithNoReply(int exptime)
           
<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)
          memcached的getMulti操作,批量获取一批key对应的数据项
<T> java.util.Map<java.lang.String,T>
get(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder)
           
<T> T
get(java.lang.String key)
           
<T> T
get(java.lang.String key, long timeout)
           
<T> T
get(java.lang.String key, long timeout, Transcoder<T> transcoder)
          Get value by key
<T> T
get(java.lang.String key, Transcoder<T> transcoder)
           
 java.util.Map<java.net.InetSocketAddress,AuthInfo> getAuthInfoMap()
          return current all auth info
 java.util.Collection<java.net.InetSocketAddress> getAvaliableServers()
          get avaliable memcached servers's socket address.
 Connector getConnector()
          return the session manager
 long getConnectTimeout()
          Get the connect timeout
 Counter getCounter(java.lang.String key)
          Get counter for key,and if the key's value is not set,then set it with 0.
 Counter getCounter(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.
 long getHealSessionInterval()
          Return the default heal session interval in milliseconds
 KeyIterator getKeyIterator(java.net.InetSocketAddress address)
          Get key iterator for special memcached server.You must known that the iterator is a snapshot for memcached all keys,it is not real-time.
 java.lang.String getName()
          Return the cache instance name
 long getOpTimeout()
          get operation timeout setting
 Protocol getProtocol()
           
 java.util.Queue<ReconnectRequest> getReconnectRequestQueue()
          Returns reconnecting task queue,the result is thread-safe,but maybe you should not modify it at all
<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)
          类似getMulti,但是返回数据项的cas值,返回的map中value存储的是GetsResponse对象
<T> java.util.Map<java.lang.String,GetsResponse<T>>
gets(java.util.Collection<java.lang.String> keyCollections, Transcoder<T> transcoder)
           
<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)
           
 java.util.List<java.lang.String> getServersDescription()
          Get current server list.You can call this method through JMX or program
 java.util.Collection<MemcachedClientStateListener> getStateListeners()
          Get all current state listeners
 java.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 servers
 java.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)
           
 Transcoder getTranscoder()
          return default transcoder,default is SerializingTranscoder
 java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions()
          Get all connected memcached servers's versions.
 java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions(long timeout)
           
 long incr(java.lang.String key, long delta)
          "incr" are used to change data for some item in-place, incrementing it.
 long incr(java.lang.String key, long delta, long initValue)
           
 long incr(java.lang.String key, long delta, long initValue, long timeout)
          "incr" are used to change data for some item in-place, incrementing it.
 long incr(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.
 void incrWithNoReply(java.lang.String key, long delta)
          "incr" are used to change data for some item in-place, incrementing it.
 boolean isFailureMode()
          Returns if client is in failure mode.
 boolean isSanitizeKeys()
           
 boolean isShutdown()
           
 boolean prepend(java.lang.String key, java.lang.Object value)
           
 boolean prepend(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.
 void prependWithNoReply(java.lang.String key, java.lang.Object value)
          Prepend value to key's data item in memcached.This method doesn't wait for reply.
 void removeServer(java.lang.String hostList)
          Remove many memcached server
 void removeStateListener(MemcachedClientStateListener listener)
          Remove a memcached client listener
 boolean replace(java.lang.String key, int exp, java.lang.Object value)
           
 boolean replace(java.lang.String key, int exp, java.lang.Object value, long timeout)
           
<T> boolean
replace(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
<T> boolean
replace(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.
 void replaceWithNoReply(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> void
replaceWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
 boolean set(java.lang.String key, int exp, java.lang.Object value)
           
 boolean set(java.lang.String key, int exp, java.lang.Object value, long timeout)
           
<T> boolean
set(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
<T> boolean
set(java.lang.String key, int exp, T value, Transcoder<T> transcoder, long timeout)
          Store key-value item to memcached
 void setAuthInfoMap(java.util.Map<java.net.InetSocketAddress,AuthInfo> map)
          Configure auth info
 void setBufferAllocator(BufferAllocator bufferAllocator)
          Deprecated. 
 void setConnectionPoolSize(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.
 void setConnectTimeout(long connectTimeout)
          Set the connect timeout,default is 1 minutes
 void setEnableHeartBeat(boolean enableHeartBeat)
          Whether to enable heart beat
 void setFailureMode(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.
 void setHealSessionInterval(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.
 void setLoggingLevelVerbosity(java.net.InetSocketAddress address, int level)
          Set the verbosity level of the memcached's logging output.This method will wait for reply.
 void setLoggingLevelVerbosityWithNoReply(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
 void setMergeFactor(int mergeFactor)
          Set the merge factor,this factor determins how many 'get' commands would be merge to one multi-get command.default is 150
 void setName(java.lang.String name)
          Set cache instance name
 void setOpTimeout(long opTimeout)
          set operation timeout,default is one second.
 void setOptimizeGet(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.
 void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
          Enable/Disable merge many command's buffers to one big buffer fit socket's send buffer size.Default is true.Recommend true.
 void setPrimitiveAsString(boolean primitiveAsString)
          Store all primitive type as string,defualt is false.
 void setSanitizeKeys(boolean sanitizeKey)
          Enables/disables sanitizing keys by URLEncoding.
 void setTranscoder(Transcoder transcoder)
          set transcoder
 void setWithNoReply(java.lang.String key, int exp, java.lang.Object value)
          Store key-value item to memcached,doesn't wait for reply
<T> void
setWithNoReply(java.lang.String key, int exp, T value, Transcoder<T> transcoder)
           
 void shutdown()
           
 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)
          查看特定节点的memcached server统计信息
 

Field Detail

DEFAULT_READ_THREAD_COUNT

static final int DEFAULT_READ_THREAD_COUNT
Default thread number for reading nio's receive buffer and dispatch commands.Recommend users to set it equal or less to the memcached server's number on linux platform,keep default on windows.Default is 0.

See Also:
Constant Field Values

DEFAULT_TCP_KEEPLIVE

static final boolean DEFAULT_TCP_KEEPLIVE
Default TCP keeplive option,which is true

See Also:
Constant Field Values

DEFAULT_CONNECT_TIMEOUT

static final int DEFAULT_CONNECT_TIMEOUT
Default connect timeout,1 minutes

See Also:
Constant Field Values

DEFAULT_TCP_SEND_BUFF_SIZE

static final int DEFAULT_TCP_SEND_BUFF_SIZE
Default socket's send buffer size,8k

See Also:
Constant Field Values

DEFAULT_TCP_NO_DELAY

static final boolean DEFAULT_TCP_NO_DELAY
Disable Nagle algorithm by default

See Also:
Constant Field Values

DEFAULT_SESSION_READ_BUFF_SIZE

static final int DEFAULT_SESSION_READ_BUFF_SIZE
Default session read buffer size,16k

See Also:
Constant Field Values

DEFAULT_TCP_RECV_BUFF_SIZE

static final int DEFAULT_TCP_RECV_BUFF_SIZE
Default socket's receive buffer size,16k

See Also:
Constant Field Values

DEFAULT_OP_TIMEOUT

static final long DEFAULT_OP_TIMEOUT
Default operation timeout,if the operation is not returned in 1 second,throw TimeoutException

See Also:
Constant Field Values

DEFAULT_CONNECTION_POOL_SIZE

static final int DEFAULT_CONNECTION_POOL_SIZE
With java nio,there is only one connection to a memcached.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. 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.Default pool size is 1.

See Also:
Constant Field Values

DEFAULT_SESSION_IDLE_TIMEOUT

static final int DEFAULT_SESSION_IDLE_TIMEOUT
Default session idle timeout,if session is idle,xmemcached will do a heartbeat action to check if connection is alive.

See Also:
Constant Field Values
Method Detail

setMergeFactor

void setMergeFactor(int mergeFactor)
Set the merge factor,this factor determins how many 'get' commands would be merge to one multi-get command.default is 150

Parameters:
mergeFactor -

getConnectTimeout

long getConnectTimeout()
Get the connect timeout

Parameters:
connectTimeout -

setConnectTimeout

void setConnectTimeout(long connectTimeout)
Set the connect timeout,default is 1 minutes

Parameters:
connectTimeout -

getConnector

Connector getConnector()
return the session manager

Returns:

setOptimizeGet

void setOptimizeGet(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.

Parameters:
optimizeGet -

setOptimizeMergeBuffer

void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
Enable/Disable merge many command's buffers to one big buffer fit socket's send buffer size.Default is true.Recommend true.

Parameters:
optimizeMergeBuffer -

isShutdown

boolean isShutdown()
Returns:

addServer

void addServer(java.lang.String server,
               int port)
               throws java.io.IOException
Aadd a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)

Parameters:
server - host string
port - port number
Throws:
java.io.IOException

addServer

void addServer(java.net.InetSocketAddress inetSocketAddress)
               throws java.io.IOException
Add a memcached server,the thread call this method will be blocked until the connecting operations completed(success or fail)

Parameters:
inetSocketAddress - memcached server's socket address
Throws:
java.io.IOException

addServer

void addServer(java.lang.String hostList)
               throws java.io.IOException
Add many memcached servers.You can call this method through JMX or program

Parameters:
host - String like [host1]:[port1] [host2]:[port2] ...
Throws:
java.io.IOException

getServersDescription

java.util.List<java.lang.String> getServersDescription()
Get current server list.You can call this method through JMX or program


removeServer

void removeServer(java.lang.String hostList)
Remove many memcached server

Parameters:
host - String like [host1]:[port1] [host2]:[port2] ...

setBufferAllocator

@Deprecated
void setBufferAllocator(BufferAllocator bufferAllocator)
Deprecated. 

Set the nio's ByteBuffer Allocator,use SimpleBufferAllocator by default.

Parameters:
bufferAllocator -

get

<T> T get(java.lang.String key,
          long timeout,
          Transcoder<T> transcoder)
      throws java.util.concurrent.TimeoutException,
             java.lang.InterruptedException,
             MemcachedException
Get value by key

Type Parameters:
T -
Parameters:
key - Key
timeout - Operation timeout,if the method is not returned in this time,throw TimeoutException
transcoder - The value's transcoder
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<T> T get(java.lang.String key,
          long timeout)
      throws java.util.concurrent.TimeoutException,
             java.lang.InterruptedException,
             MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<T> T get(java.lang.String key,
          Transcoder<T> transcoder)
      throws java.util.concurrent.TimeoutException,
             java.lang.InterruptedException,
             MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<T> T get(java.lang.String key)
      throws java.util.concurrent.TimeoutException,
             java.lang.InterruptedException,
             MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<T> GetsResponse<T> gets(java.lang.String key,
                         long timeout,
                         Transcoder<T> transcoder)
                     throws java.util.concurrent.TimeoutException,
                            java.lang.InterruptedException,
                            MemcachedException
Just like get,But it return a GetsResponse,include cas value for cas update.

Type Parameters:
T -
Parameters:
key - key
timeout - operation timeout
transcoder -
Returns:
GetsResponse
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<T> GetsResponse<T> gets(java.lang.String key)
                     throws java.util.concurrent.TimeoutException,
                            java.lang.InterruptedException,
                            MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<T> GetsResponse<T> gets(java.lang.String key,
                         long timeout)
                     throws java.util.concurrent.TimeoutException,
                            java.lang.InterruptedException,
                            MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<T> GetsResponse<T> gets(java.lang.String key,
                         Transcoder transcoder)
                     throws java.util.concurrent.TimeoutException,
                            java.lang.InterruptedException,
                            MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<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,
                                             MemcachedException
memcached的getMulti操作,批量获取一批key对应的数据项

Type Parameters:
T -
Parameters:
keyCollections - 关键字集合
timeout - 操作超时时间
transcoder - 数据项的反序列化转换器
Returns:
map对象,map中是缓存中存在着的数据项,如果不存在将不会在map中出现
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

get

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<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
类似getMulti,但是返回数据项的cas值,返回的map中value存储的是GetsResponse对象

Type Parameters:
T -
Parameters:
keyCollections -
timeout -
transcoder -
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

gets

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

set

<T> boolean set(java.lang.String key,
                int exp,
                T value,
                Transcoder<T> transcoder,
                long timeout)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Store key-value item to memcached

Type Parameters:
T -
Parameters:
key - stored key
exp - expire time
value - stored data
transcoder - transocder
timeout - operation timeout,in milliseconds
Returns:
boolean result
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

set

boolean set(java.lang.String key,
            int exp,
            java.lang.Object value)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

set

boolean set(java.lang.String key,
            int exp,
            java.lang.Object value,
            long timeout)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

set

<T> boolean set(java.lang.String key,
                int exp,
                T value,
                Transcoder<T> transcoder)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

setWithNoReply

void setWithNoReply(java.lang.String key,
                    int exp,
                    java.lang.Object value)
                    throws java.lang.InterruptedException,
                           MemcachedException
Store key-value item to memcached,doesn't wait for reply

Type Parameters:
T -
Parameters:
key - stored key
exp - expire time
value - stored data
transcoder - transocder
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

setWithNoReply

<T> void setWithNoReply(java.lang.String key,
                        int exp,
                        T value,
                        Transcoder<T> transcoder)
                    throws java.lang.InterruptedException,
                           MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

add

<T> boolean add(java.lang.String key,
                int exp,
                T value,
                Transcoder<T> transcoder,
                long timeout)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Add key-value item to memcached, success only when the key is not exists in memcached.

Type Parameters:
T -
Parameters:
key -
exp -
value -
transcoder -
timeout -
Returns:
boolean result
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

add

boolean add(java.lang.String key,
            int exp,
            java.lang.Object value)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

add

boolean add(java.lang.String key,
            int exp,
            java.lang.Object value,
            long timeout)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

add

<T> boolean add(java.lang.String key,
                int exp,
                T value,
                Transcoder<T> transcoder)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

addWithNoReply

void addWithNoReply(java.lang.String key,
                    int exp,
                    java.lang.Object value)
                    throws java.lang.InterruptedException,
                           MemcachedException
Add key-value item to memcached, success only when the key is not exists in memcached.This method doesn't wait for reply.

Type Parameters:
T -
Parameters:
key -
exp -
value -
transcoder -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

addWithNoReply

<T> void addWithNoReply(java.lang.String key,
                        int exp,
                        T value,
                        Transcoder<T> transcoder)
                    throws java.lang.InterruptedException,
                           MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

replace

<T> boolean replace(java.lang.String key,
                    int exp,
                    T value,
                    Transcoder<T> transcoder,
                    long timeout)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
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.

Type Parameters:
T -
Parameters:
key -
exp -
value -
transcoder -
timeout -
Returns:
boolean result
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

replace

boolean replace(java.lang.String key,
                int exp,
                java.lang.Object value)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

replace

boolean replace(java.lang.String key,
                int exp,
                java.lang.Object value,
                long timeout)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

replace

<T> boolean replace(java.lang.String key,
                    int exp,
                    T value,
                    Transcoder<T> transcoder)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

replaceWithNoReply

void replaceWithNoReply(java.lang.String key,
                        int exp,
                        java.lang.Object value)
                        throws java.lang.InterruptedException,
                               MemcachedException
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.

Type Parameters:
T -
Parameters:
key -
exp -
value -
transcoder -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

replaceWithNoReply

<T> void replaceWithNoReply(java.lang.String key,
                            int exp,
                            T value,
                            Transcoder<T> transcoder)
                        throws java.lang.InterruptedException,
                               MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

append

boolean append(java.lang.String key,
               java.lang.Object value)
               throws java.util.concurrent.TimeoutException,
                      java.lang.InterruptedException,
                      MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

append

boolean append(java.lang.String key,
               java.lang.Object value,
               long timeout)
               throws java.util.concurrent.TimeoutException,
                      java.lang.InterruptedException,
                      MemcachedException
Append value to key's data item,this method will wait for reply

Parameters:
key -
value -
timeout -
Returns:
boolean result
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

appendWithNoReply

void appendWithNoReply(java.lang.String key,
                       java.lang.Object value)
                       throws java.lang.InterruptedException,
                              MemcachedException
Append value to key's data item,this method doesn't wait for reply.

Parameters:
key -
value -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

prepend

boolean prepend(java.lang.String key,
                java.lang.Object value)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

prepend

boolean prepend(java.lang.String key,
                java.lang.Object value,
                long timeout)
                throws java.util.concurrent.TimeoutException,
                       java.lang.InterruptedException,
                       MemcachedException
Prepend value to key's data item in memcached.This method doesn't wait for reply.

Parameters:
key -
value -
Returns:
boolean result
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

prependWithNoReply

void prependWithNoReply(java.lang.String key,
                        java.lang.Object value)
                        throws java.lang.InterruptedException,
                               MemcachedException
Prepend value to key's data item in memcached.This method doesn't wait for reply.

Parameters:
key -
value -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

boolean cas(java.lang.String key,
            int exp,
            java.lang.Object value,
            long cas)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<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,
                   MemcachedException
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."

Type Parameters:
T -
Parameters:
key -
exp -
value -
transcoder -
timeout -
cas -
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<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
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<T> boolean cas(java.lang.String key,
                int exp,
                CASOperation<T> operation,
                Transcoder<T> transcoder)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
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."

Type Parameters:
T -
Parameters:
key -
exp - 缓存数据项的超时时间
operation - CASOperation对象,包装cas操作
transcoder - 对象转换器
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<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,
                   MemcachedException
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."

Type Parameters:
T -
Parameters:
key -
exp - data item expire time
getsReponse - gets method's result
operation - CASOperation
transcoder -
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<T> boolean cas(java.lang.String key,
                int exp,
                GetsResponse<T> getsReponse,
                CASOperation<T> operation)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<T> boolean cas(java.lang.String key,
                GetsResponse<T> getsResponse,
                CASOperation<T> operation)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<T> boolean cas(java.lang.String key,
                int exp,
                CASOperation<T> operation)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

cas

<T> boolean cas(java.lang.String key,
                CASOperation<T> operation)
            throws java.util.concurrent.TimeoutException,
                   java.lang.InterruptedException,
                   MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

casWithNoReply

<T> void casWithNoReply(java.lang.String key,
                        GetsResponse<T> getsResponse,
                        CASOperation<T> operation)
                    throws java.util.concurrent.TimeoutException,
                           java.lang.InterruptedException,
                           MemcachedException
Type Parameters:
T -
Parameters:
key -
getsResponse -
operation -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

casWithNoReply

<T> void casWithNoReply(java.lang.String key,
                        int exp,
                        GetsResponse<T> getsReponse,
                        CASOperation<T> operation)
                    throws java.util.concurrent.TimeoutException,
                           java.lang.InterruptedException,
                           MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

casWithNoReply

<T> void casWithNoReply(java.lang.String key,
                        int exp,
                        CASOperation<T> operation)
                    throws java.util.concurrent.TimeoutException,
                           java.lang.InterruptedException,
                           MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

casWithNoReply

<T> void casWithNoReply(java.lang.String key,
                        CASOperation<T> operation)
                    throws java.util.concurrent.TimeoutException,
                           java.lang.InterruptedException,
                           MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

delete

@Deprecated
boolean delete(java.lang.String key,
                          int time)
               throws java.util.concurrent.TimeoutException,
                      java.lang.InterruptedException,
                      MemcachedException
Deprecated. 

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. 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.

Parameters:
key -
time -
Throws:
java.lang.InterruptedException
MemcachedException
java.util.concurrent.TimeoutException

getVersions

java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions()
                                                                       throws java.util.concurrent.TimeoutException,
                                                                              java.lang.InterruptedException,
                                                                              MemcachedException
Get all connected memcached servers's versions.

Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

incr

long incr(java.lang.String key,
          long delta)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key -
num -
Returns:
the new value of the item's data, after the increment operation was carried out.
Throws:
java.lang.InterruptedException
MemcachedException
java.util.concurrent.TimeoutException

incr

long incr(java.lang.String key,
          long delta,
          long initValue)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

incr

long incr(java.lang.String key,
          long delta,
          long initValue,
          long timeout)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key - key
num - increment
initValue - initValue if the data is not exists.
timeout - operation timeout
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

decr

long decr(java.lang.String key,
          long delta)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key -
num -
Returns:
the new value of the item's data, after the decrement operation was carried out.
Throws:
java.lang.InterruptedException
MemcachedException
java.util.concurrent.TimeoutException

decr

long decr(java.lang.String key,
          long delta,
          long initValue)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
Parameters:
key -
num -
initValue -
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException
See Also:
decr

decr

long decr(java.lang.String key,
          long delta,
          long initValue,
          long timeout)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key - The key
num - The increment
initValue - The initial value if the data is not exists.
timeout - Operation timeout
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

flushAll

void flushAll()
              throws java.util.concurrent.TimeoutException,
                     java.lang.InterruptedException,
                     MemcachedException
Make All connected memcached's data item invalid

Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

flushAllWithNoReply

void flushAllWithNoReply()
                         throws java.lang.InterruptedException,
                                MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

flushAll

void flushAll(long timeout)
              throws java.util.concurrent.TimeoutException,
                     java.lang.InterruptedException,
                     MemcachedException
Make All connected memcached's data item invalid

Parameters:
timeout - operation timeout
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

flushAll

void flushAll(java.net.InetSocketAddress address)
              throws MemcachedException,
                     java.lang.InterruptedException,
                     java.util.concurrent.TimeoutException
Invalidate all existing items immediately

Parameters:
address - Target memcached server
timeout - operation timeout
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

flushAllWithNoReply

void flushAllWithNoReply(java.net.InetSocketAddress address)
                         throws MemcachedException,
                                java.lang.InterruptedException
Throws:
MemcachedException
java.lang.InterruptedException

flushAll

void flushAll(java.net.InetSocketAddress address,
              long timeout)
              throws MemcachedException,
                     java.lang.InterruptedException,
                     java.util.concurrent.TimeoutException
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

flushAll

@Deprecated
void flushAll(java.lang.String host)
              throws java.util.concurrent.TimeoutException,
                     java.lang.InterruptedException,
                     MemcachedException
Deprecated. 

This method is deprecated,please use flushAll(InetSocketAddress) instead.

Parameters:
host -
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

stats

java.util.Map<java.lang.String,java.lang.String> stats(java.net.InetSocketAddress address)
                                                       throws MemcachedException,
                                                              java.lang.InterruptedException,
                                                              java.util.concurrent.TimeoutException
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

stats

java.util.Map<java.lang.String,java.lang.String> stats(java.net.InetSocketAddress address,
                                                       long timeout)
                                                       throws MemcachedException,
                                                              java.lang.InterruptedException,
                                                              java.util.concurrent.TimeoutException
查看特定节点的memcached server统计信息

Parameters:
address - 节点地址
timeout - 操作超时
Returns:
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

getStats

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.TimeoutException
Get stats from all memcached servers

Parameters:
timeout -
Returns:
server->item->value map
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

getStats

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
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

getStatsByItem

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.TimeoutException
Get special item stats. "stats items" for example

Parameters:
item -
Returns:
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

shutdown

void shutdown()
              throws java.io.IOException
Throws:
java.io.IOException

delete

boolean delete(java.lang.String key)
               throws java.util.concurrent.TimeoutException,
                      java.lang.InterruptedException,
                      MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

getTranscoder

Transcoder getTranscoder()
return default transcoder,default is SerializingTranscoder

Returns:

setTranscoder

void setTranscoder(Transcoder transcoder)
set transcoder

Parameters:
transcoder -

getStatsByItem

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
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

getOpTimeout

long getOpTimeout()
get operation timeout setting

Returns:

setOpTimeout

void setOpTimeout(long opTimeout)
set operation timeout,default is one second.

Parameters:
opTimeout -

getVersions

java.util.Map<java.net.InetSocketAddress,java.lang.String> getVersions(long timeout)
                                                                       throws java.util.concurrent.TimeoutException,
                                                                              java.lang.InterruptedException,
                                                                              MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

getAvaliableServers

java.util.Collection<java.net.InetSocketAddress> getAvaliableServers()
get avaliable memcached servers's socket address.

Returns:

addServer

void addServer(java.lang.String server,
               int port,
               int weight)
               throws java.io.IOException
add a memcached server to MemcachedClient

Parameters:
server -
port -
weight -
Throws:
java.io.IOException

addServer

void addServer(java.net.InetSocketAddress inetSocketAddress,
               int weight)
               throws java.io.IOException
Throws:
java.io.IOException

deleteWithNoReply

@Deprecated
void deleteWithNoReply(java.lang.String key,
                                  int time)
                       throws java.lang.InterruptedException,
                              MemcachedException
Deprecated. 

Delete key's data item from memcached.This method doesn't wait for reply. This method does not work on memcached 1.3 or later version.See i s s u e 3
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.

Parameters:
key -
time -
Throws:
java.lang.InterruptedException
MemcachedException

deleteWithNoReply

void deleteWithNoReply(java.lang.String key)
                       throws java.lang.InterruptedException,
                              MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

incrWithNoReply

void incrWithNoReply(java.lang.String key,
                     long delta)
                     throws java.lang.InterruptedException,
                            MemcachedException
"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.

Parameters:
key -
num -
Throws:
java.lang.InterruptedException
MemcachedException

decrWithNoReply

void decrWithNoReply(java.lang.String key,
                     long delta)
                     throws java.lang.InterruptedException,
                            MemcachedException
"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.

Parameters:
key -
num -
Throws:
java.lang.InterruptedException
MemcachedException

setLoggingLevelVerbosity

void setLoggingLevelVerbosity(java.net.InetSocketAddress address,
                              int level)
                              throws java.util.concurrent.TimeoutException,
                                     java.lang.InterruptedException,
                                     MemcachedException
Set the verbosity level of the memcached's logging output.This method will wait for reply.

Parameters:
address -
level - logging level
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

setLoggingLevelVerbosityWithNoReply

void setLoggingLevelVerbosityWithNoReply(java.net.InetSocketAddress address,
                                         int level)
                                         throws java.lang.InterruptedException,
                                                MemcachedException
Set the verbosity level of the memcached's logging output.This method doesn't wait for reply from server

Parameters:
address - memcached server address
level - logging level
Throws:
java.lang.InterruptedException
MemcachedException

addStateListener

void addStateListener(MemcachedClientStateListener listener)
Add a memcached client listener

Parameters:
listener -

removeStateListener

void removeStateListener(MemcachedClientStateListener listener)
Remove a memcached client listener

Parameters:
listener -

getStateListeners

java.util.Collection<MemcachedClientStateListener> getStateListeners()
Get all current state listeners

Returns:

flushAllWithNoReply

void flushAllWithNoReply(int exptime)
                         throws java.lang.InterruptedException,
                                MemcachedException
Throws:
java.lang.InterruptedException
MemcachedException

flushAll

void flushAll(int exptime,
              long timeout)
              throws java.util.concurrent.TimeoutException,
                     java.lang.InterruptedException,
                     MemcachedException
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

flushAllWithNoReply

void flushAllWithNoReply(java.net.InetSocketAddress address,
                         int exptime)
                         throws MemcachedException,
                                java.lang.InterruptedException
Throws:
MemcachedException
java.lang.InterruptedException

flushAll

void flushAll(java.net.InetSocketAddress address,
              long timeout,
              int exptime)
              throws MemcachedException,
                     java.lang.InterruptedException,
                     java.util.concurrent.TimeoutException
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

setHealSessionInterval

void setHealSessionInterval(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. You can change that value by this method.

Parameters:
healConnectionInterval - MILLISECONDS

getHealSessionInterval

long getHealSessionInterval()
Return the default heal session interval in milliseconds

Returns:

getProtocol

Protocol getProtocol()

setPrimitiveAsString

void setPrimitiveAsString(boolean primitiveAsString)
Store all primitive type as string,defualt is false.


setConnectionPoolSize

void setConnectionPoolSize(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. 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.

Parameters:
poolSize - pool size,default is one,every memcached has only one connection.

setEnableHeartBeat

void setEnableHeartBeat(boolean enableHeartBeat)
Whether to enable heart beat

Parameters:
enableHeartBeat - if true,then enable heartbeat,true by default

setSanitizeKeys

void setSanitizeKeys(boolean sanitizeKey)
Enables/disables sanitizing keys by URLEncoding.

Parameters:
sanitizeKey - if true, then URLEncode all keys

isSanitizeKeys

boolean isSanitizeKeys()

getCounter

Counter getCounter(java.lang.String key)
Get counter for key,and if the key's value is not set,then set it with 0.

Parameters:
key -
Returns:

getCounter

Counter getCounter(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.

Parameters:
key -
initialValue -
Returns:

getKeyIterator

KeyIterator getKeyIterator(java.net.InetSocketAddress address)
                           throws MemcachedException,
                                  java.lang.InterruptedException,
                                  java.util.concurrent.TimeoutException
Get key iterator for special memcached server.You must known that the iterator is a snapshot for memcached all keys,it is not real-time.

Parameters:
address -
Returns:
Throws:
MemcachedException
java.lang.InterruptedException
java.util.concurrent.TimeoutException

setAuthInfoMap

void setAuthInfoMap(java.util.Map<java.net.InetSocketAddress,AuthInfo> map)
Configure auth info

Parameters:
map - Auth info map,key is memcached server address,and value is the auth info for the key.

getAuthInfoMap

java.util.Map<java.net.InetSocketAddress,AuthInfo> getAuthInfoMap()
return current all auth info

Returns:
Auth info map,key is memcached server address,and value is the auth info for the key.

decr

long decr(java.lang.String key,
          long delta,
          long initValue,
          long timeout,
          int exp)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key -
delta -
initValue - the initial value to be added when value is not found
timeout -
exp - the initial vlaue expire time
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

incr

long incr(java.lang.String key,
          long delta,
          long initValue,
          long timeout,
          int exp)
          throws java.util.concurrent.TimeoutException,
                 java.lang.InterruptedException,
                 MemcachedException
"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.

Parameters:
key - key
delta - increment delta
initValue - the initial value to be added when value is not found
timeout - operation timeout
exp - the initial vlaue expire time
Returns:
Throws:
java.util.concurrent.TimeoutException
java.lang.InterruptedException
MemcachedException

getName

java.lang.String getName()
Return the cache instance name

Returns:

setName

void setName(java.lang.String name)
Set cache instance name

Parameters:
name -

getReconnectRequestQueue

java.util.Queue<ReconnectRequest> getReconnectRequestQueue()
Returns reconnecting task queue,the result is thread-safe,but maybe you should not modify it at all

Returns:
The reconnecting task queue,if the client has not been started,returns null.

setFailureMode

void setFailureMode(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. 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.

Parameters:
failureMode - true is to configure client in failure mode.

isFailureMode

boolean isFailureMode()
Returns if client is in failure mode.

Returns:


Copyright © 2011. All Rights Reserved.