public class XMemcachedClientBuilder extends Object implements MemcachedClientBuilder
| 构造器和说明 |
|---|
XMemcachedClientBuilder() |
XMemcachedClientBuilder(List<InetSocketAddress> addressList) |
XMemcachedClientBuilder(List<InetSocketAddress> addressList,
int[] weights) |
XMemcachedClientBuilder(Map<InetSocketAddress,InetSocketAddress> addressMap) |
XMemcachedClientBuilder(Map<InetSocketAddress,InetSocketAddress> addressMap,
int[] weights) |
XMemcachedClientBuilder(String addressList) |
| 限定符和类型 | 方法和说明 |
|---|---|
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
|
static Configuration |
getDefaultConfiguration() |
static Map<SocketOption,Object> |
getDefaultSocketOptions() |
long |
getHealSessionInterval() |
int |
getMaxQueuedNoReplyOperations() |
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 |
isEnableHealSession() |
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> authInfoMap)
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 healSessionInterval)
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) |
public XMemcachedClientBuilder(String addressList)
public XMemcachedClientBuilder(List<InetSocketAddress> addressList)
public XMemcachedClientBuilder(List<InetSocketAddress> addressList, int[] weights)
public XMemcachedClientBuilder(Map<InetSocketAddress,InetSocketAddress> addressMap)
public XMemcachedClientBuilder(Map<InetSocketAddress,InetSocketAddress> addressMap, int[] weights)
public XMemcachedClientBuilder()
public long getOpTimeout()
MemcachedClientBuildergetOpTimeout 在接口中 MemcachedClientBuilderpublic void setOpTimeout(long opTimeout)
MemcachedClientBuildersetOpTimeout 在接口中 MemcachedClientBuilderopTimeout - Operation timeout value in milliseconds.public int getMaxQueuedNoReplyOperations()
public long getHealSessionInterval()
public void setHealSessionInterval(long healSessionInterval)
MemcachedClientBuildersetHealSessionInterval 在接口中 MemcachedClientBuilderhealSessionInterval - MILLISECONDSpublic boolean isEnableHealSession()
public void setEnableHealSession(boolean enableHealSession)
MemcachedClientBuilder client.setEnableHealSession(false); setEnableHealSession 在接口中 MemcachedClientBuilderpublic void setMaxQueuedNoReplyOperations(int maxQueuedNoReplyOperations)
setMaxQueuedNoReplyOperations 在接口中 MemcachedClientBuildermaxQueuedNoReplyOperations - MemcachedClient.DEFAULT_MAX_QUEUED_NOPSpublic void setSanitizeKeys(boolean sanitizeKeys)
MemcachedClientBuildersetSanitizeKeys 在接口中 MemcachedClientBuilderpublic void addStateListener(MemcachedClientStateListener stateListener)
MemcachedClientBuilderaddStateListener 在接口中 MemcachedClientBuilderpublic void setSocketOption(SocketOption socketOption, Object value)
MemcachedClientBuildersetSocketOption 在接口中 MemcachedClientBuilderpublic Map<SocketOption,Object> getSocketOptions()
MemcachedClientBuildergetSocketOptions 在接口中 MemcachedClientBuilderpublic final void setConnectionPoolSize(int poolSize)
MemcachedClientBuildersetConnectionPoolSize 在接口中 MemcachedClientBuilderpoolSize - pool size,default is 1public void removeStateListener(MemcachedClientStateListener stateListener)
MemcachedClientBuilderremoveStateListener 在接口中 MemcachedClientBuilderpublic long getConnectTimeout()
MemcachedClientBuildergetConnectTimeout 在接口中 MemcachedClientBuilderpublic void setConnectTimeout(long connectTimeout)
MemcachedClientBuilderpublic void setStateListeners(List<MemcachedClientStateListener> stateListeners)
MemcachedClientBuildersetStateListeners 在接口中 MemcachedClientBuilderpublic static final Map<SocketOption,Object> getDefaultSocketOptions()
public static final Configuration getDefaultConfiguration()
public boolean isFailureMode()
MemcachedClientBuilderisFailureMode 在接口中 MemcachedClientBuilderpublic void setFailureMode(boolean failureMode)
MemcachedClientBuildersetFailureMode 在接口中 MemcachedClientBuilderfailureMode - true is to configure client in failure mode.public final CommandFactory getCommandFactory()
MemcachedClientBuildergetCommandFactory 在接口中 MemcachedClientBuilderpublic final void setCommandFactory(CommandFactory commandFactory)
MemcachedClientBuildersetCommandFactory 在接口中 MemcachedClientBuilderpublic MemcachedSessionLocator getSessionLocator()
getSessionLocator 在接口中 MemcachedClientBuilderpublic void setSessionLocator(MemcachedSessionLocator sessionLocator)
MemcachedClientBuildersetSessionLocator 在接口中 MemcachedClientBuilderpublic BufferAllocator getBufferAllocator()
getBufferAllocator 在接口中 MemcachedClientBuilderpublic void setBufferAllocator(BufferAllocator bufferAllocator)
MemcachedClientBuildersetBufferAllocator 在接口中 MemcachedClientBuilderpublic Configuration getConfiguration()
MemcachedClientBuildergetConfiguration 在接口中 MemcachedClientBuilderpublic void setConfiguration(Configuration configuration)
MemcachedClientBuildersetConfiguration 在接口中 MemcachedClientBuilderpublic MemcachedClient build() throws IOException
MemcachedClientBuilderbuild 在接口中 MemcachedClientBuilderIOExceptionpublic Transcoder getTranscoder()
MemcachedClientBuildergetTranscoder 在接口中 MemcachedClientBuilderpublic void setTranscoder(Transcoder transcoder)
setTranscoder 在接口中 MemcachedClientBuilderpublic Map<InetSocketAddress,AuthInfo> getAuthInfoMap()
MemcachedClientBuildergetAuthInfoMap 在接口中 MemcachedClientBuilderpublic void setKeyProvider(KeyProvider keyProvider)
MemcachedClientBuildersetKeyProvider 在接口中 MemcachedClientBuilderpublic void addAuthInfo(InetSocketAddress address, AuthInfo authInfo)
MemcachedClientBuilderaddAuthInfo 在接口中 MemcachedClientBuilderpublic void removeAuthInfo(InetSocketAddress address)
MemcachedClientBuilderremoveAuthInfo 在接口中 MemcachedClientBuilderpublic void setAuthInfoMap(Map<InetSocketAddress,AuthInfo> authInfoMap)
MemcachedClientBuildersetAuthInfoMap 在接口中 MemcachedClientBuilderauthInfoMap - Auth info map,key is memcached server address,and value is the
auth info for the key.public String getName()
MemcachedClientBuildergetName 在接口中 MemcachedClientBuilderpublic void setName(String name)
MemcachedClientBuildersetName 在接口中 MemcachedClientBuilderCopyright © 2013. All Rights Reserved.