public class XMemcachedClient extends Object implements XMemcachedClientMBean, MemcachedClient
| 限定符和类型 | 字段和说明 |
|---|---|
protected CommandFactory |
commandFactory |
protected int |
connectionPoolSize |
protected MemcachedConnector |
connector |
protected int |
maxQueuedNoReplyOperations |
static ThreadLocal<String> |
NAMESPACE_LOCAL
namespace thread local.
|
protected AtomicInteger |
serverOrderCount |
protected MemcachedSessionLocator |
sessionLocator |
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| 构造器和说明 |
|---|
XMemcachedClient() |
XMemcachedClient(InetSocketAddress inetSocketAddress) |
XMemcachedClient(InetSocketAddress inetSocketAddress,
int weight)
XMemcached Constructor.
|
XMemcachedClient(List<InetSocketAddress> addressList)
XMemcached Constructor.Every server's weight is one by default.
|
XMemcachedClient(String server,
int port)
XMemcached constructor,default weight is 1
|
XMemcachedClient(String host,
int port,
int weight)
XMemcached constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(String key,
int exp,
Object value) |
boolean |
add(String key,
int exp,
Object value,
long timeout) |
<T> boolean |
add(String key,
int exp,
T value,
Transcoder<T> transcoder) |
<T> boolean |
add(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 |
addOneServerWithWeight(String server,
int weight)
Add a memcached server
|
void |
addServer(InetSocketAddress inetSocketAddress)
Add a memcached server,the thread call this method will be blocked until
the connecting operations completed(success or fail)
|
void |
addServer(InetSocketAddress inetSocketAddress,
int weight) |
void |
addServer(String hostList)
Add memcached servers
|
void |
addServer(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(String server,
int port,
int weight)
add a memcached server to MemcachedClient
|
void |
addStateListener(MemcachedClientStateListener listener)
Add a memcached client listener
|
void |
addWithNoReply(String key,
int exp,
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(String key,
int exp,
T value,
Transcoder<T> transcoder) |
boolean |
append(String key,
Object value) |
boolean |
append(String key,
Object value,
long timeout)
Append value to key's data item,this method will wait for reply
|
void |
appendWithNoReply(String key,
Object value)
Append value to key's data item,this method doesn't wait for reply.
|
void |
beginWithNamespace(String ns)
set current namespace for following operations with memcached client.It
must be ended with
MemcachedClient.endWithNamespace() method.For example:
memcachedClient.beginWithNamespace(userId);
try{
memcachedClient.set("username",0,username);
memcachedClient.set("email",0,email);
}finally{
memcachedClient.endWithNamespace();
}
|
<T> boolean |
cas(String key,
CASOperation<T> operation) |
<T> boolean |
cas(String key,
GetsResponse<T> getsReponse,
CASOperation<T> operation) |
<T> boolean |
cas(String key,
int exp,
CASOperation<T> operation) |
<T> boolean |
cas(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(String key,
int exp,
GetsResponse<T> getsReponse,
CASOperation<T> operation) |
<T> boolean |
cas(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(String key,
int exp,
Object value,
long cas) |
boolean |
cas(String key,
int exp,
Object value,
long timeout,
long cas) |
<T> boolean |
cas(String key,
int exp,
T value,
Transcoder<T> transcoder,
long cas) |
<T> boolean |
cas(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(String key,
CASOperation<T> operation) |
<T> void |
casWithNoReply(String key,
GetsResponse<T> getsResponse,
CASOperation<T> operation) |
<T> void |
casWithNoReply(String key,
int exp,
CASOperation<T> operation) |
<T> void |
casWithNoReply(String key,
int exp,
GetsResponse<T> getsReponse,
CASOperation<T> operation)
cas noreply
|
protected void |
checkSocketAddress(InetSocketAddress address) |
long |
decr(String key,
long delta)
"decr" are used to change data for some item in-place, decrementing it.
|
long |
decr(String key,
long delta,
long initValue) |
long |
decr(String key,
long delta,
long initValue,
long timeout)
"decr" are used to change data for some item in-place, decrementing it.
|
long |
decr(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(String key,
long delta)
"decr" are used to change data for some item in-place, decrementing it.
|
boolean |
delete(String key) |
boolean |
delete(String key,
int time)
Delete key's data item from memcached.It it is not exists,return
false.
|
boolean |
delete(String key,
long opTimeout)
Delete key's date item from memcached
|
boolean |
delete(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.
|
void |
deleteWithNoReply(String key) |
void |
deleteWithNoReply(String key,
int time)
Delete key's data item from memcached.This method doesn't wait for reply
|
void |
endWithNamespace()
Remove current namespace set for this memcached client.It must begin with
MemcachedClient.beginWithNamespace(String) method. |
void |
flushAll()
Make All connected memcached's data item invalid
|
void |
flushAll(InetSocketAddress address)
Invalidate all existing items immediately
|
void |
flushAll(InetSocketAddress address,
long timeout) |
void |
flushAll(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(String host)
This method is deprecated,please use flushAll(InetSocketAddress) instead.
|
void |
flushAllWithNoReply() |
void |
flushAllWithNoReply(InetSocketAddress address) |
void |
flushAllWithNoReply(InetSocketAddress address,
int exptime) |
void |
flushAllWithNoReply(int exptime) |
<T> Map<String,T> |
get(Collection<String> keyCollections) |
<T> Map<String,T> |
get(Collection<String> keyCollections,
long timeout) |
<T> Map<String,T> |
get(Collection<String> keyCollections,
long timeout,
Transcoder<T> transcoder)
Bulk get items
|
<T> Map<String,T> |
get(Collection<String> keyCollections,
Transcoder<T> transcoder) |
<T> T |
get(String key) |
<T> T |
get(String key,
long timeout) |
<T> T |
get(String key,
long timeout,
Transcoder<T> transcoder)
Get value by key
|
<T> T |
get(String key,
Transcoder<T> transcoder) |
<T> T |
getAndTouch(String key,
int newExp)
Get item and set a new expiration time for it,using default opTimeout
|
<T> T |
getAndTouch(String key,
int newExp,
long opTimeout)
Get item and set a new expiration time for it
|
Map<InetSocketAddress,AuthInfo> |
getAuthInfoMap()
return current all auth info
|
Collection<InetSocketAddress> |
getAvailableServers()
Returns available memcached servers list.
|
Collection<InetSocketAddress> |
getAvaliableServers()
已过时。
|
CommandFactory |
getCommandFactory() |
int |
getConnectionSizeBySocketAddress(InetSocketAddress address) |
Connector |
getConnector()
return the session manager
|
long |
getConnectTimeout()
Get the connect timeout
|
Counter |
getCounter(String key)
Get counter for key,and if the key's value is not set,then set it with 0.
|
Counter |
getCounter(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(InetSocketAddress address)
已过时。
memcached 1.6.x will remove cachedump stats command,so this
method will be removed in the future
|
KeyProvider |
getKeyProvider() |
String |
getName()
Return the cache instance name
|
String |
getNamespace(String ns)
Returns the real namespace of ns.
|
long |
getOpTimeout()
get operation timeout setting
|
Protocol |
getProtocol() |
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> Map<String,GetsResponse<T>> |
gets(Collection<String> keyCollections) |
<T> Map<String,GetsResponse<T>> |
gets(Collection<String> keyCollections,
long timeout) |
<T> Map<String,GetsResponse<T>> |
gets(Collection<String> keyCollections,
long timeout,
Transcoder<T> transcoder)
Bulk gets items
|
<T> Map<String,GetsResponse<T>> |
gets(Collection<String> keyCollections,
Transcoder<T> transcoder) |
<T> GetsResponse<T> |
gets(String key) |
<T> GetsResponse<T> |
gets(String key,
long timeout) |
<T> GetsResponse<T> |
gets(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(String key,
Transcoder transcoder) |
List<String> |
getServersDescription()
Get all connected memcached servers
|
MemcachedSessionLocator |
getSessionLocator() |
Collection<MemcachedClientStateListener> |
getStateListeners()
Get all current state listeners
|
Map<InetSocketAddress,Map<String,String>> |
getStats() |
Map<InetSocketAddress,Map<String,String>> |
getStats(long timeout)
Get stats from all memcached servers
|
Map<InetSocketAddress,Map<String,String>> |
getStatsByItem(String itemName)
Get special item stats.
|
Map<InetSocketAddress,Map<String,String>> |
getStatsByItem(String itemName,
long timeout) |
int |
getTimeoutExceptionThreshold()
Returns maximum number of timeout exception for closing connection.
|
Transcoder |
getTranscoder()
return default transcoder,default is SerializingTranscoder
|
Map<InetSocketAddress,String> |
getVersions()
Get all connected memcached servers's version.
|
Map<InetSocketAddress,String> |
getVersions(long timeout) |
long |
incr(String key,
long delta)
"incr" are used to change data for some item in-place, incrementing it.
|
long |
incr(String key,
long delta,
long initValue) |
long |
incr(String key,
long delta,
long initValue,
long timeout)
"incr" are used to change data for some item in-place, incrementing it.
|
long |
incr(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(String key,
long delta)
"incr" are used to change data for some item in-place, incrementing it.
|
void |
invalidateNamespace(String ns)
Invalidate all namespace under the namespace using the default operation
timeout.
|
void |
invalidateNamespace(String ns,
long opTimeout)
Invalidate all items under the namespace.
|
boolean |
isFailureMode()
Returns if client is in failure mode.
|
boolean |
isSanitizeKeys() |
boolean |
isShutdown() |
protected MemcachedConnector |
newConnector(BufferAllocator bufferAllocator,
Configuration configuration,
MemcachedSessionLocator memcachedSessionLocator,
CommandFactory commandFactory,
int poolSize,
int maxQueuedNoReplyOperations) |
protected InetSocketAddress |
newSocketAddress(String server,
int port) |
boolean |
prepend(String key,
Object value) |
boolean |
prepend(String key,
Object value,
long timeout)
Prepend value to key's data item in memcached.This method doesn't wait
for reply.
|
void |
prependWithNoReply(String key,
Object value)
Prepend value to key's data item in memcached.This method doesn't wait
for reply.
|
void |
removeServer(String hostList)
Remove memcached servers
|
void |
removeStateListener(MemcachedClientStateListener listener)
Remove a memcached client listener
|
boolean |
replace(String key,
int exp,
Object value) |
boolean |
replace(String key,
int exp,
Object value,
long timeout) |
<T> boolean |
replace(String key,
int exp,
T value,
Transcoder<T> transcoder) |
<T> boolean |
replace(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(String key,
int exp,
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(String key,
int exp,
T value,
Transcoder<T> transcoder) |
boolean |
set(String key,
int exp,
Object value) |
boolean |
set(String key,
int exp,
Object value,
long timeout) |
<T> boolean |
set(String key,
int exp,
T value,
Transcoder<T> transcoder) |
<T> boolean |
set(String key,
int exp,
T value,
Transcoder<T> transcoder,
long timeout)
Store key-value item to memcached
|
void |
setAuthInfoMap(Map<InetSocketAddress,AuthInfo> map)
Configure auth info
|
void |
setBufferAllocator(BufferAllocator bufferAllocator)
Set the nio's ByteBuffer Allocator,use SimpleBufferAllocator by default.
|
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 |
setEnableHealSession(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. |
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 |
setKeyProvider(KeyProvider keyProvider)
Set a key provider for pre-processing keys before sending them to
memcached.
|
void |
setLoggingLevelVerbosity(InetSocketAddress address,
int level)
Set the verbosity level of the memcached's logging output.This method
will wait for reply.
|
void |
setLoggingLevelVerbosityWithNoReply(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(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 sanitizeKeys)
Enables/disables sanitizing keys by URLEncoding.
|
void |
setServerWeight(String server,
int weight)
Set a memcached server's weight
|
void |
setTimeoutExceptionThreshold(int timeoutExceptionThreshold)
Set maximum number of timeout exception for closing connection.You can
set it to be a large value to disable this feature.
|
void |
setTranscoder(Transcoder transcoder)
set transcoder
|
void |
setWithNoReply(String key,
int exp,
Object value)
Store key-value item to memcached,doesn't wait for reply
|
<T> void |
setWithNoReply(String key,
int exp,
T value,
Transcoder<T> transcoder) |
void |
shutdown() |
Map<String,String> |
stats(InetSocketAddress address) |
Map<String,String> |
stats(InetSocketAddress address,
long timeout)
�ョ��瑰������emcached server缁��淇℃�
|
boolean |
touch(String key,
int exp)
Set a new expiration time for an existing item,using default opTimeout
second.
|
boolean |
touch(String key,
int exp,
long opTimeout)
Set a new expiration time for an existing item
|
<T> T |
withNamespace(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.
|
protected MemcachedSessionLocator sessionLocator
protected MemcachedConnector connector
protected CommandFactory commandFactory
protected int connectionPoolSize
protected int maxQueuedNoReplyOperations
protected final AtomicInteger serverOrderCount
public static final ThreadLocal<String> NAMESPACE_LOCAL
public XMemcachedClient(String server, int port) throws IOException
server - �����Pport - ����ㄧ���IOExceptionpublic XMemcachedClient(String host, int port, int weight) throws IOException
host - server hostport - server portweight - server weightIOExceptionpublic XMemcachedClient(InetSocketAddress inetSocketAddress, int weight) throws IOException
inetSocketAddress - weight - IOExceptionpublic XMemcachedClient(InetSocketAddress inetSocketAddress) throws IOException
IOExceptionpublic XMemcachedClient()
throws IOException
IOExceptionpublic XMemcachedClient(List<InetSocketAddress> addressList) throws IOException
addressList - IOExceptionpublic final void setMergeFactor(int mergeFactor)
MemcachedClientsetMergeFactor 在接口中 MemcachedClientpublic int getTimeoutExceptionThreshold()
MemcachedClientgetTimeoutExceptionThreshold 在接口中 MemcachedClientpublic void setTimeoutExceptionThreshold(int timeoutExceptionThreshold)
MemcachedClientpublic <T> T withNamespace(String ns, MemcachedClientCallable<T> callable) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientMemcachedClient.beginWithNamespace(String) and MemcachedClient.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);
public void endWithNamespace()
MemcachedClientMemcachedClient.beginWithNamespace(String) method.public void beginWithNamespace(String ns)
MemcachedClientMemcachedClient.endWithNamespace() method.For example:
memcachedClient.beginWithNamespace(userId);
try{
memcachedClient.set("username",0,username);
memcachedClient.set("email",0,email);
}finally{
memcachedClient.endWithNamespace();
}
public KeyProvider getKeyProvider()
public void setKeyProvider(KeyProvider keyProvider)
MemcachedClientsetKeyProvider 在接口中 MemcachedClientpublic final MemcachedSessionLocator getSessionLocator()
public final CommandFactory getCommandFactory()
public String getName()
XMemcachedClientMBeangetName 在接口中 MemcachedClientgetName 在接口中 XMemcachedClientMBeanpublic void setName(String name)
MemcachedClientsetName 在接口中 MemcachedClientpublic long getConnectTimeout()
MemcachedClientgetConnectTimeout 在接口中 MemcachedClientpublic void setConnectTimeout(long connectTimeout)
MemcachedClientsetConnectTimeout 在接口中 MemcachedClientpublic void setEnableHeartBeat(boolean enableHeartBeat)
MemcachedClientsetEnableHeartBeat 在接口中 MemcachedClientenableHeartBeat - if true,then enable heartbeat,true by defaultpublic final long getOpTimeout()
getOpTimeout 在接口中 MemcachedClientpublic final void setOpTimeout(long opTimeout)
setOpTimeout 在接口中 MemcachedClientopTimeout - public void setHealSessionInterval(long healConnectionInterval)
MemcachedClientsetHealSessionInterval 在接口中 MemcachedClienthealConnectionInterval - MILLISECONDSpublic long getHealSessionInterval()
MemcachedClientgetHealSessionInterval 在接口中 MemcachedClientpublic Map<InetSocketAddress,AuthInfo> getAuthInfoMap()
MemcachedClientgetAuthInfoMap 在接口中 MemcachedClientpublic void setAuthInfoMap(Map<InetSocketAddress,AuthInfo> map)
MemcachedClientsetAuthInfoMap 在接口中 MemcachedClientmap - Auth info map,key is memcached server address,and value is the
auth info for the key.public final Connector getConnector()
MemcachedClientgetConnector 在接口中 MemcachedClientpublic final void setOptimizeMergeBuffer(boolean optimizeMergeBuffer)
MemcachedClientsetOptimizeMergeBuffer 在接口中 MemcachedClientpublic final boolean isShutdown()
isShutdown 在接口中 MemcachedClientprotected InetSocketAddress newSocketAddress(String server, int port)
public final void addServer(String server, int port) throws IOException
MemcachedClientaddServer 在接口中 MemcachedClientserver - host stringport - port numberIOExceptionpublic final void addServer(String server, int port, int weight) throws IOException
addServer 在接口中 MemcachedClientserver - port - weight - IOExceptionpublic final void addServer(InetSocketAddress inetSocketAddress) throws IOException
MemcachedClientaddServer 在接口中 MemcachedClientinetSocketAddress - memcached server's socket addressIOExceptionpublic final void addServer(InetSocketAddress inetSocketAddress, int weight) throws IOException
addServer 在接口中 MemcachedClientIOExceptionpublic final void addServer(String hostList) throws IOException
XMemcachedClientMBeanaddServer 在接口中 MemcachedClientaddServer 在接口中 XMemcachedClientMBeanIOExceptionpublic void addOneServerWithWeight(String server, int weight) throws IOException
XMemcachedClientMBeanaddOneServerWithWeight 在接口中 XMemcachedClientMBeanserver - a String in the form of "[host1]:[port1],[host2]:[port2]"weight - server's weightIOExceptionpublic final List<String> getServersDescription()
XMemcachedClientMBeangetServersDescription 在接口中 MemcachedClientgetServersDescription 在接口中 XMemcachedClientMBeanpublic final void setServerWeight(String server, int weight)
XMemcachedClientMBeansetServerWeight 在接口中 XMemcachedClientMBeanpublic final void removeServer(String hostList)
XMemcachedClientMBeanremoveServer 在接口中 MemcachedClientremoveServer 在接口中 XMemcachedClientMBeanprotected void checkSocketAddress(InetSocketAddress address)
protected MemcachedConnector newConnector(BufferAllocator bufferAllocator, Configuration configuration, MemcachedSessionLocator memcachedSessionLocator, CommandFactory commandFactory, int poolSize, int maxQueuedNoReplyOperations)
public void setOptimizeGet(boolean optimizeGet)
MemcachedClientsetOptimizeGet 在接口中 MemcachedClientpublic final void setBufferAllocator(BufferAllocator bufferAllocator)
MemcachedClientsetBufferAllocator 在接口中 MemcachedClientpublic final <T> T get(String key, long timeout, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientget 在接口中 MemcachedClientkey - Keytimeout - Operation timeout,if the method is not returned in this
time,throw TimeoutExceptiontranscoder - The value's transcoderTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> T get(String key, long timeout) throws TimeoutException, InterruptedException, MemcachedException
get 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> T get(String key, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
get 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> T get(String key) throws TimeoutException, InterruptedException, MemcachedException
get 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> GetsResponse<T> gets(String key, long timeout, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientgets 在接口中 MemcachedClientkey - keytimeout - operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> GetsResponse<T> gets(String key) throws TimeoutException, InterruptedException, MemcachedException
public final <T> GetsResponse<T> gets(String key, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> GetsResponse<T> gets(String key, Transcoder transcoder) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,T> get(Collection<String> keyCollections, long timeout, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientget 在接口中 MemcachedClientkeyCollections - key collectiontimeout - opTimeouttranscoder - Value transcoderTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> Map<String,T> get(Collection<String> keyCollections, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,T> get(Collection<String> keyCollections) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,T> get(Collection<String> keyCollections, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,GetsResponse<T>> gets(Collection<String> keyCollections, long timeout, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientgets 在接口中 MemcachedClientkeyCollections - key collectiontimeout - Operation timeouttranscoder - Value transcoderTimeoutExceptionInterruptedExceptionMemcachedExceptionGetsResponsepublic final <T> Map<String,GetsResponse<T>> gets(Collection<String> keyCollections) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,GetsResponse<T>> gets(Collection<String> keyCollections, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> Map<String,GetsResponse<T>> gets(Collection<String> keyCollections, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean set(String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientset 在接口中 MemcachedClientkey - 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 millisecondsTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic void setWithNoReply(String key, int exp, Object value) throws InterruptedException, MemcachedException
MemcachedClientsetWithNoReply 在接口中 MemcachedClientkey - 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 dataInterruptedExceptionMemcachedExceptionpublic <T> void setWithNoReply(String key, int exp, T value, Transcoder<T> transcoder) throws InterruptedException, MemcachedException
public final boolean set(String key, int exp, Object value) throws TimeoutException, InterruptedException, MemcachedException
public final boolean set(String key, int exp, Object value, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean set(String key, int exp, T value, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean add(String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientadd 在接口中 MemcachedClientexp - An expiration time, in seconds. Can be up to 30 days. After 30
days, is treated as a unix timestamp of an exact date.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final boolean add(String key, int exp, Object value) throws TimeoutException, InterruptedException, MemcachedException
public final boolean add(String key, int exp, Object value, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean add(String key, int exp, T value, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
public void addWithNoReply(String key, int exp, Object value) throws InterruptedException, MemcachedException
MemcachedClientaddWithNoReply 在接口中 MemcachedClientexp - An expiration time, in seconds. Can be up to 30 days. After 30
days, is treated as a unix timestamp of an exact date.InterruptedExceptionMemcachedExceptionpublic <T> void addWithNoReply(String key, int exp, T value, Transcoder<T> transcoder) throws InterruptedException, MemcachedException
public void replaceWithNoReply(String key, int exp, Object value) throws InterruptedException, MemcachedException
MemcachedClientreplaceWithNoReply 在接口中 MemcachedClientexp - An expiration time, in seconds. Can be up to 30 days. After 30
days, is treated as a unix timestamp of an exact date.InterruptedExceptionMemcachedExceptionpublic <T> void replaceWithNoReply(String key, int exp, T value, Transcoder<T> transcoder) throws InterruptedException, MemcachedException
public final <T> boolean replace(String key, int exp, T value, Transcoder<T> transcoder, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientreplace 在接口中 MemcachedClientexp - An expiration time, in seconds. Can be up to 30 days. After 30
days, is treated as a unix timestamp of an exact date.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final boolean replace(String key, int exp, Object value) throws TimeoutException, InterruptedException, MemcachedException
public final boolean replace(String key, int exp, Object value, long timeout) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean replace(String key, int exp, T value, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
public final boolean append(String key, Object value) throws TimeoutException, InterruptedException, MemcachedException
public final boolean append(String key, Object value, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientappend 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic void appendWithNoReply(String key, Object value) throws InterruptedException, MemcachedException
MemcachedClientpublic final boolean prepend(String key, Object value) throws TimeoutException, InterruptedException, MemcachedException
public final boolean prepend(String key, Object value, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientprepend 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic void prependWithNoReply(String key, Object value) throws InterruptedException, MemcachedException
MemcachedClientpublic final boolean cas(String key, int exp, Object value, long cas) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean cas(String key, int exp, T value, Transcoder<T> transcoder, long timeout, long cas) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientcas 在接口中 MemcachedClientexp - An expiration time, in seconds. Can be up to 30 days. After 30
days, is treated as a unix timestamp of an exact date.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final boolean cas(String key, int exp, Object value, long timeout, long cas) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean cas(String key, int exp, T value, Transcoder<T> transcoder, long cas) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean cas(String key, int exp, CASOperation<T> operation, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientcas 在接口中 MemcachedClientexp - 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 transcoderTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> boolean cas(String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation, Transcoder<T> transcoder) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientcas 在接口中 MemcachedClientexp - 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 - CASOperationTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final <T> boolean cas(String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public <T> void casWithNoReply(String key, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public <T> void casWithNoReply(String key, GetsResponse<T> getsResponse, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public <T> void casWithNoReply(String key, int exp, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public <T> void casWithNoReply(String key, int exp, GetsResponse<T> getsReponse, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientpublic final <T> boolean cas(String key, GetsResponse<T> getsReponse, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean cas(String key, int exp, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public final <T> boolean cas(String key, CASOperation<T> operation) throws TimeoutException, InterruptedException, MemcachedException
public final boolean delete(String key, int time) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientpublic boolean delete(String key, long opTimeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientdelete 在接口中 MemcachedClientopTimeout - Operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic boolean delete(String key, long cas, long opTimeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientdelete 在接口中 MemcachedClientopTimeout - Operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final void deleteWithNoReply(String key, int time) throws InterruptedException, MemcachedException
deleteWithNoReply 在接口中 MemcachedClientkey - time - InterruptedExceptionMemcachedExceptionpublic final void deleteWithNoReply(String key) throws InterruptedException, MemcachedException
public boolean touch(String key, int exp, long opTimeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClienttouch 在接口中 MemcachedClientkey - 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 timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic boolean touch(String key, int exp) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClienttouch 在接口中 MemcachedClientkey - 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.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic <T> T getAndTouch(String key, int newExp, long opTimeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientgetAndTouch 在接口中 MemcachedClientkey - 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 timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic <T> T getAndTouch(String key, int newExp) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientgetAndTouch 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final long incr(String key, long delta) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientincr 在接口中 MemcachedClientInterruptedExceptionMemcachedExceptionTimeoutExceptionpublic long incr(String key, long delta, long initValue) throws TimeoutException, InterruptedException, MemcachedException
public long incr(String key, long delta, long initValue, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientincr 在接口中 MemcachedClientkey - keyinitValue - initValue if the data is not exists.timeout - operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic long incr(String key, long delta, long initValue, long timeout, int exp) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientincr 在接口中 MemcachedClientkey - 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.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final void incrWithNoReply(String key, long delta) throws InterruptedException, MemcachedException
MemcachedClientincrWithNoReply 在接口中 MemcachedClientInterruptedExceptionMemcachedExceptionpublic final void decrWithNoReply(String key, long delta) throws InterruptedException, MemcachedException
MemcachedClientdecrWithNoReply 在接口中 MemcachedClientInterruptedExceptionMemcachedExceptionpublic final long decr(String key, long delta) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientdecr 在接口中 MemcachedClientInterruptedExceptionMemcachedExceptionTimeoutExceptionpublic long decr(String key, long delta, long initValue) throws TimeoutException, InterruptedException, MemcachedException
decr 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptiondecrpublic long decr(String key, long delta, long initValue, long timeout) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientdecr 在接口中 MemcachedClientkey - The keyinitValue - The initial value if the data is not exists.timeout - Operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic long decr(String key, long delta, long initValue, long timeout, int exp) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientdecr 在接口中 MemcachedClientinitValue - 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.TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final void flushAll()
throws TimeoutException,
InterruptedException,
MemcachedException
MemcachedClientpublic void flushAllWithNoReply()
throws InterruptedException,
MemcachedException
public void flushAllWithNoReply(int exptime)
throws InterruptedException,
MemcachedException
public void flushAllWithNoReply(InetSocketAddress address) throws MemcachedException, InterruptedException
public void flushAllWithNoReply(InetSocketAddress address, int exptime) throws MemcachedException, InterruptedException
public final void flushAll(int exptime,
long timeout)
throws TimeoutException,
InterruptedException,
MemcachedException
public final void flushAll(long timeout)
throws TimeoutException,
InterruptedException,
MemcachedException
MemcachedClientflushAll 在接口中 MemcachedClienttimeout - operation timeoutTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic void setLoggingLevelVerbosity(InetSocketAddress address, int level) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientsetLoggingLevelVerbosity 在接口中 MemcachedClientlevel - logging levelTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic void setLoggingLevelVerbosityWithNoReply(InetSocketAddress address, int level) throws InterruptedException, MemcachedException
MemcachedClientsetLoggingLevelVerbosityWithNoReply 在接口中 MemcachedClientaddress - memcached server addresslevel - logging levelInterruptedExceptionMemcachedExceptionpublic final void flushAll(InetSocketAddress address) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientflushAll 在接口中 MemcachedClientaddress - Target memcached serverMemcachedExceptionInterruptedExceptionTimeoutExceptionpublic final void flushAll(InetSocketAddress address, long timeout) throws MemcachedException, InterruptedException, TimeoutException
public final void flushAll(InetSocketAddress address, long timeout, int exptime) throws MemcachedException, InterruptedException, TimeoutException
public final void flushAll(String host) throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientpublic final Map<String,String> stats(InetSocketAddress address) throws MemcachedException, InterruptedException, TimeoutException
public final Map<String,String> stats(InetSocketAddress address, long timeout) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientstats 在接口中 MemcachedClientaddress - ����板�timeout - ���瓒��MemcachedExceptionInterruptedExceptionTimeoutExceptionpublic final Map<InetSocketAddress,Map<String,String>> getStats() throws MemcachedException, InterruptedException, TimeoutException
public final Map<InetSocketAddress,Map<String,String>> getStatsByItem(String itemName) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientgetStatsByItem 在接口中 MemcachedClientMemcachedExceptionInterruptedExceptionTimeoutExceptionpublic final Map<InetSocketAddress,Map<String,String>> getStatsByItem(String itemName, long timeout) throws MemcachedException, InterruptedException, TimeoutException
public final Map<InetSocketAddress,String> getVersions() throws TimeoutException, InterruptedException, MemcachedException
MemcachedClientgetVersions 在接口中 MemcachedClientTimeoutExceptionInterruptedExceptionMemcachedExceptionpublic final Map<InetSocketAddress,String> getVersions(long timeout) throws TimeoutException, InterruptedException, MemcachedException
public Map<InetSocketAddress,Map<String,String>> getStats(long timeout) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientgetStats 在接口中 MemcachedClientMemcachedExceptionInterruptedExceptionTimeoutExceptionpublic final void shutdown()
throws IOException
shutdown 在接口中 MemcachedClientIOExceptionpublic void setConnectionPoolSize(int poolSize)
MemcachedClientsetConnectionPoolSize 在接口中 MemcachedClientpoolSize - pool size,default is one,every memcached has only one
connection.public final boolean delete(String key) throws TimeoutException, InterruptedException, MemcachedException
public final Transcoder getTranscoder()
MemcachedClientgetTranscoder 在接口中 MemcachedClientpublic final void setTranscoder(Transcoder transcoder)
MemcachedClientsetTranscoder 在接口中 MemcachedClient@Deprecated public final Collection<InetSocketAddress> getAvaliableServers()
getAvaliableServers 在接口中 MemcachedClientMemcachedClient.getAvailableServers()public Collection<InetSocketAddress> getAvailableServers()
MemcachedClientgetAvailableServers 在接口中 MemcachedClientpublic final int getConnectionSizeBySocketAddress(InetSocketAddress address)
public void addStateListener(MemcachedClientStateListener listener)
MemcachedClientaddStateListener 在接口中 MemcachedClientpublic Collection<MemcachedClientStateListener> getStateListeners()
MemcachedClientgetStateListeners 在接口中 MemcachedClientpublic void setPrimitiveAsString(boolean primitiveAsString)
MemcachedClientsetPrimitiveAsString 在接口中 MemcachedClientpublic void removeStateListener(MemcachedClientStateListener listener)
MemcachedClientremoveStateListener 在接口中 MemcachedClientpublic Protocol getProtocol()
getProtocol 在接口中 MemcachedClientpublic boolean isSanitizeKeys()
isSanitizeKeys 在接口中 MemcachedClientpublic void setSanitizeKeys(boolean sanitizeKeys)
MemcachedClientsetSanitizeKeys 在接口中 MemcachedClientsanitizeKeys - if true, then URLEncode all keyspublic void invalidateNamespace(String ns, long opTimeout) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientinvalidateNamespace 在接口中 MemcachedClientns - the namespaceopTimeout - operation timeout in milliseconds.MemcachedExceptionInterruptedExceptionTimeoutExceptionpublic void invalidateNamespace(String ns) throws MemcachedException, InterruptedException, TimeoutException
MemcachedClientinvalidateNamespace 在接口中 MemcachedClientns - the namespaceMemcachedExceptionInterruptedExceptionTimeoutExceptionpublic String getNamespace(String ns) throws TimeoutException, InterruptedException, MemcachedException
ns - TimeoutExceptionInterruptedExceptionMemcachedExceptionpublic Counter getCounter(String key, long initialValue)
MemcachedClientgetCounter 在接口中 MemcachedClientpublic Counter getCounter(String key)
MemcachedClientgetCounter 在接口中 MemcachedClient@Deprecated public KeyIterator getKeyIterator(InetSocketAddress address) throws MemcachedException, TimeoutException, InterruptedException
MemcachedClientgetKeyIterator 在接口中 MemcachedClientMemcachedExceptionTimeoutExceptionInterruptedExceptionpublic void setEnableHealSession(boolean enableHealSession)
MemcachedClient client.setEnableHealSession(false); setEnableHealSession 在接口中 MemcachedClientpublic void setFailureMode(boolean failureMode)
MemcachedClientsetFailureMode 在接口中 MemcachedClientfailureMode - true is to configure client in failure mode.public boolean isFailureMode()
MemcachedClientisFailureMode 在接口中 MemcachedClientpublic Queue<ReconnectRequest> getReconnectRequestQueue()
MemcachedClientgetReconnectRequestQueue 在接口中 MemcachedClientCopyright © 2013. All Rights Reserved.