Package net.rubyeye.xmemcached.aws
Class AWSElasticCacheClient
java.lang.Object
net.rubyeye.xmemcached.XMemcachedClient
net.rubyeye.xmemcached.aws.AWSElasticCacheClient
- All Implemented Interfaces:
ConfigUpdateListener
,MemcachedClient
,XMemcachedClientMBean
AWS ElasticCache Client.
- Since:
- 2.3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<InetSocketAddress> private final ConfigurationPoller
private ClusterConfiguration
static final long
Default elasticcache configuration poll interval, it's one minute.private boolean
private static final org.slf4j.Logger
Fields inherited from class net.rubyeye.xmemcached.XMemcachedClient
commandFactory, connectionPoolSize, connector, maxQueuedNoReplyOperations, NAMESPACE_LOCAL, opTimeout, resolveInetAddresses, serverOrderCount, sessionComparator, sessionLocator
Fields inherited from interface net.rubyeye.xmemcached.MemcachedClient
DEFAULT_CONNECT_TIMEOUT, DEFAULT_CONNECTION_POOL_SIZE, DEFAULT_HEAL_SESSION_INTERVAL, DEFAULT_MAX_QUEUED_NOPS, DEFAULT_MAX_TIMEOUTEXCEPTION_THRESHOLD, DEFAULT_OP_TIMEOUT, DEFAULT_READ_THREAD_COUNT, DEFAULT_SESSION_IDLE_TIMEOUT, DEFAULT_SESSION_READ_BUFF_SIZE, DEFAULT_TCP_KEEPLIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_RECV_BUFF_SIZE, DEFAULT_TCP_SEND_BUFF_SIZE, DYNAMIC_MAX_QUEUED_NOPS, MAX_QUEUED_NOPS
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an AWSElasticCacheClient instance with one config address and default poll interval.AWSElasticCacheClient
(InetSocketAddress addr, long pollConfigIntervalMills) Construct an AWSElasticCacheClient instance with one config address and poll interval.AWSElasticCacheClient
(InetSocketAddress addr, long pollConfigIntervalMills, CommandFactory cmdFactory) Construct an AWSElasticCacheClient instance with config server addresses and default config poll interval.AWSElasticCacheClient
(List<InetSocketAddress> addrs, long pollConfigIntervalMills) Construct an AWSElasticCacheClient instance with config server addresses.AWSElasticCacheClient
(List<InetSocketAddress> addrs, long pollConfigIntervalMills, CommandFactory commandFactory) Construct an AWSElasticCacheClient instance with config server addresses.AWSElasticCacheClient
(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, Map<SocketOption, Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, List<MemcachedClientStateListener> stateListeners, Map<InetSocketAddress, AuthInfo> map, int poolSize, long connectTimeout, String name, boolean failureMode, boolean resolveInetAddresses, List<InetSocketAddress> configAddrs, long pollConfigIntervalMills) -
Method Summary
Modifier and TypeMethodDescriptionprivate static List
<InetSocketAddress> asList
(InetSocketAddress addr) private static Map
<InetSocketAddress, InetSocketAddress> getAddressMapFromConfigAddrs
(List<InetSocketAddress> configAddrs) Get cluster config from cache node by network command.Get config by key from cache node by network command.Get the current using configuration in memory.void
onUpdate
(ClusterConfiguration config) Called when config is changed.private void
protected void
For subclass override.Methods inherited from class net.rubyeye.xmemcached.XMemcachedClient
add, add, add, add, addOneServerWithWeight, addServer, addServer, addServer, addServer, addServer, addStateListener, addWithNoReply, addWithNoReply, append, append, appendWithNoReply, beginWithNamespace, cas, cas, cas, cas, cas, cas, cas, cas, cas, cas, casWithNoReply, casWithNoReply, casWithNoReply, casWithNoReply, checkException, connect, decr, decr, decr, decr, decrWithNoReply, delete, delete, delete, delete, deleteWithNoReply, deleteWithNoReply, endWithNamespace, flushAll, flushAll, flushAll, flushAll, flushAll, flushAll, flushAll, flushAllWithNoReply, flushAllWithNoReply, flushAllWithNoReply, flushAllWithNoReply, get, get, get, get, get, get, get, get, getAndTouch, getAndTouch, getAuthInfoMap, getAuthInfoStringMap, getAvailableServers, getAvaliableServers, getCommandFactory, getConnectionSizeBySocketAddress, getConnector, getConnectTimeout, getCounter, getCounter, getHealSessionInterval, getKeyIterator, getKeyProvider, getName, getNamespace, getOpTimeout, getProtocol, getReconnectRequestQueue, gets, gets, gets, gets, gets, gets, gets, gets, getServersDescription, getSessionComparator, getSessionLocator, getStateListeners, getStats, getStats, getStatsByItem, getStatsByItem, getTimeoutExceptionThreshold, getTranscoder, getVersions, getVersions, incr, incr, incr, incr, incrWithNoReply, invalidateNamespace, invalidateNamespace, isFailureMode, isSanitizeKeys, isShutdown, latchWait, newConnector, newSocketAddress, prepend, prepend, prependWithNoReply, removeServer, removeServer, removeStateListener, replace, replace, replace, replace, replaceWithNoReply, replaceWithNoReply, sendCommand, set, set, set, set, setAuthInfoMap, setBufferAllocator, setConnectionPoolSize, setConnectTimeout, setEnableHealSession, setEnableHeartBeat, setFailureMode, setHealSessionInterval, setKeyProvider, setLoggingLevelVerbosity, setLoggingLevelVerbosityWithNoReply, setMergeFactor, setName, setOpTimeout, setOptimizeGet, setOptimizeMergeBuffer, setPrimitiveAsString, setSanitizeKeys, setServerWeight, setTimeoutExceptionThreshold, setTranscoder, setWithNoReply, setWithNoReply, shutdown, stats, stats, touch, touch, withNamespace
-
Field Details
-
log
private static final org.slf4j.Logger log -
firstTimeUpdate
private boolean firstTimeUpdate -
configAddrs
-
configPoller
-
DEFAULT_POLL_CONFIG_INTERVAL_MS
public static final long DEFAULT_POLL_CONFIG_INTERVAL_MSDefault elasticcache configuration poll interval, it's one minute.- See Also:
-
currentClusterConfiguration
-
-
Constructor Details
-
AWSElasticCacheClient
Construct an AWSElasticCacheClient instance with one config address and default poll interval.- Parameters:
addr
- config server address.- Throws:
IOException
- Since:
- 2.3.0
-
AWSElasticCacheClient
public AWSElasticCacheClient(InetSocketAddress addr, long pollConfigIntervalMills) throws IOException Construct an AWSElasticCacheClient instance with one config address and poll interval.- Parameters:
addr
- config server address.pollConfigIntervalMills
- config poll interval in milliseconds.- Throws:
IOException
- Since:
- 2.3.0
-
AWSElasticCacheClient
public AWSElasticCacheClient(InetSocketAddress addr, long pollConfigIntervalMills, CommandFactory cmdFactory) throws IOException - Throws:
IOException
-
AWSElasticCacheClient
Construct an AWSElasticCacheClient instance with config server addresses and default config poll interval.- Parameters:
addrs
- config server list.- Throws:
IOException
- Since:
- 2.3.0
-
AWSElasticCacheClient
public AWSElasticCacheClient(List<InetSocketAddress> addrs, long pollConfigIntervalMills) throws IOException Construct an AWSElasticCacheClient instance with config server addresses.- Parameters:
addrs
-pollConfigIntervalMills
-- Throws:
IOException
- Since:
- 2.3.0
-
AWSElasticCacheClient
public AWSElasticCacheClient(List<InetSocketAddress> addrs, long pollConfigIntervalMills, CommandFactory commandFactory) throws IOException Construct an AWSElasticCacheClient instance with config server addresses.- Parameters:
addrs
- config server list.pollConfigIntervalMills
- config poll interval in milliseconds.commandFactory
- protocol command factory.- Throws:
IOException
- Since:
- 2.3.0
-
AWSElasticCacheClient
AWSElasticCacheClient(MemcachedSessionLocator locator, MemcachedSessionComparator comparator, BufferAllocator allocator, Configuration conf, Map<SocketOption, Object> socketOptions, CommandFactory commandFactory, Transcoder transcoder, List<MemcachedClientStateListener> stateListeners, Map<InetSocketAddress, throws IOExceptionAuthInfo> map, int poolSize, long connectTimeout, String name, boolean failureMode, boolean resolveInetAddresses, List<InetSocketAddress> configAddrs, long pollConfigIntervalMills) - Throws:
IOException
-
-
Method Details
-
onUpdate
Description copied from interface:ConfigUpdateListener
Called when config is changed.- Specified by:
onUpdate
in interfaceConfigUpdateListener
- Parameters:
config
- the new config
-
removeConfigAddrs
private void removeConfigAddrs() -
asList
-
getAddressMapFromConfigAddrs
private static Map<InetSocketAddress,InetSocketAddress> getAddressMapFromConfigAddrs(List<InetSocketAddress> configAddrs) -
getConfig
public ClusterConfiguration getConfig() throws MemcachedException, InterruptedException, TimeoutExceptionGet cluster config from cache node by network command.- Returns:
- Throws:
MemcachedException
InterruptedException
TimeoutException
-
getConfig
public ClusterConfiguration getConfig(String key) throws MemcachedException, InterruptedException, TimeoutException Get config by key from cache node by network command.- Returns:
- clusetr config.
- Throws:
MemcachedException
InterruptedException
TimeoutException
- Since:
- 2.3.0
-
shutdown0
protected void shutdown0()Description copied from class:XMemcachedClient
For subclass override.- Overrides:
shutdown0
in classXMemcachedClient
-
getCurrentConfig
Get the current using configuration in memory.- Returns:
- current cluster config.
- Since:
- 2.3.0
-