public interface MemcachedClientBuilder
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addAuthInfo(InetSocketAddress address,
AuthInfo authInfo)
Add auth info for memcached server
|
void |
addStateListener(MemcachedClientStateListener stateListener)
Add a state listener
|
MemcachedClient |
build()
Build MemcachedClient by current options.
|
Map<InetSocketAddress,AuthInfo> |
getAuthInfoMap()
return current all auth info
|
BufferAllocator |
getBufferAllocator() |
CommandFactory |
getCommandFactory()
get xmemcached's command factory
|
Configuration |
getConfiguration()
Return the default networking's configuration,you can change them.
|
long |
getConnectTimeout()
Returns connect timeout in milliseconds
|
String |
getName()
Return the cache instance name
|
long |
getOpTimeout()
Returns the default operation timeout in milliseconds.
|
MemcachedSessionLocator |
getSessionLocator() |
Map<SocketOption,Object> |
getSocketOptions()
Get all tcp socket options
|
Transcoder |
getTranscoder()
Set xmemcached's transcoder,it is used for seriailizing
|
boolean |
isFailureMode()
Returns if client is in failure mode.
|
void |
removeAuthInfo(InetSocketAddress address)
Remove auth info for memcached server
|
void |
removeStateListener(MemcachedClientStateListener stateListener)
Remove a state listener
|
void |
setAuthInfoMap(Map<InetSocketAddress,AuthInfo> map)
Configure auth info
|
void |
setBufferAllocator(BufferAllocator bufferAllocator)
Set nio ByteBuffer's allocator.Use SimpleBufferAllocator by default.You
can choose CachedBufferAllocator.
|
void |
setCommandFactory(CommandFactory commandFactory)
set xmemcached's command factory.Default is TextCommandFactory,which
implements memcached text protocol.
|
void |
setConfiguration(Configuration configuration)
Set the XmemcachedClient's networking
configuration(reuseAddr,receiveBufferSize,tcpDelay etc.)
|
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 connect timeout in milliseconds
|
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 |
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 |
setMaxQueuedNoReplyOperations(int maxQueuedNoReplyOperations)
Set max queued noreply operations number
|
void |
setName(String name)
Set cache instance name
|
void |
setOpTimeout(long opTimeout)
Set default operation timeout.
|
void |
setSanitizeKeys(boolean sanitizeKeys)
Enables/disables sanitizing keys by URLEncoding.
|
void |
setSessionLocator(MemcachedSessionLocator sessionLocator)
Set the XmemcachedClient's session locator.Use
ArrayMemcachedSessionLocator by default.If you want to choose consistent
hash strategy,set it to KetamaMemcachedSessionLocator
|
void |
setSocketOption(SocketOption socketOption,
Object value)
Set tcp socket option
|
void |
setStateListeners(List<MemcachedClientStateListener> stateListeners)
Set state listeners,replace current list
|
void |
setTranscoder(Transcoder transcoder) |
MemcachedSessionLocator getSessionLocator()
void setSessionLocator(MemcachedSessionLocator sessionLocator)
sessionLocator - BufferAllocator getBufferAllocator()
void setBufferAllocator(BufferAllocator bufferAllocator)
bufferAllocator - Configuration getConfiguration()
void setConfiguration(Configuration configuration)
configuration - MemcachedClient build() throws IOException
IOExceptionvoid setConnectionPoolSize(int poolSize)
poolSize - pool size,default is 1Transcoder getTranscoder()
void setTranscoder(Transcoder transcoder)
CommandFactory getCommandFactory()
void addStateListener(MemcachedClientStateListener stateListener)
stateListener - void removeStateListener(MemcachedClientStateListener stateListener)
stateListener - void setStateListeners(List<MemcachedClientStateListener> stateListeners)
stateListeners - void setCommandFactory(CommandFactory commandFactory)
commandFactory - void setSocketOption(SocketOption socketOption, Object value)
socketOption - value - Map<SocketOption,Object> getSocketOptions()
void setAuthInfoMap(Map<InetSocketAddress,AuthInfo> map)
map - Auth info map,key is memcached server address,and value is the
auth info for the key.Map<InetSocketAddress,AuthInfo> getAuthInfoMap()
void addAuthInfo(InetSocketAddress address, AuthInfo authInfo)
address - authInfo - void removeAuthInfo(InetSocketAddress address)
address - String getName()
void setName(String name)
name - void setFailureMode(boolean failureMode)
failureMode - true is to configure client in failure mode.boolean isFailureMode()
long getConnectTimeout()
void setConnectTimeout(long connectTimeout)
connectTimeout - MemcachedClient.DEFAULT_CONNECT_TIMEOUTvoid setSanitizeKeys(boolean sanitizeKeys)
sanitizeKey - if true, then URLEncode all keysvoid setKeyProvider(KeyProvider keyProvider)
keyProvider - void setMaxQueuedNoReplyOperations(int maxQueuedNoReplyOperations)
maxQueuedNoReplyOperations - MemcachedClient.DEFAULT_MAX_QUEUED_NOPSvoid setHealSessionInterval(long healConnectionInterval)
healConnectionInterval - MILLISECONDSvoid setEnableHealSession(boolean enableHealSession)
client.setEnableHealSession(false); enableHealSession - void setOpTimeout(long opTimeout)
opTimeout - Operation timeout value in milliseconds.long getOpTimeout()
Copyright © 2013. All Rights Reserved.