Class JedisClusterConnection
java.lang.Object
org.springframework.data.redis.connection.jedis.JedisClusterConnection
- All Implemented Interfaces:
AutoCloseable,DefaultedRedisClusterConnection,DefaultedRedisConnection,RedisClusterCommands,RedisClusterCommandsProvider,RedisClusterConnection,RedisClusterServerCommands,RedisCommands,RedisCommandsProvider,RedisConnection,RedisConnectionCommands,RedisGeoCommands,RedisHashCommands,RedisHyperLogLogCommands,RedisKeyCommands,RedisListCommands,RedisPubSubCommands,RedisScriptingCommands,RedisServerCommands,RedisSetCommands,RedisStreamCommands,RedisStringCommands,RedisTxCommands,RedisZSetCommands
RedisClusterConnection implementation on top of JedisCluster.Uses the native
JedisCluster api where possible and falls back to direct node communication using
Jedis where needed.
This class is not Thread-safe and instances should not be shared across threads.
- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch, Ninad Divadkar, Tao Chen, Chen Guanqun, Pavel Khokhlov, Liming Deng, John Blum
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceJedisspecificClusterCommandExecutor.ClusterCommandCallback.protected static classstatic classJedis specific implementation ofClusterTopologyProvider.protected static interfaceJedisspecificClusterCommandExecutor.MultiKeyClusterCommandCallback.Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisClusterCommands
RedisClusterCommands.AddSlotsNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisGeoCommands
RedisGeoCommands.DistanceUnit, RedisGeoCommands.GeoCommandArgs, RedisGeoCommands.GeoLocation<T>, RedisGeoCommands.GeoRadiusCommandArgs, RedisGeoCommands.GeoSearchCommandArgs, RedisGeoCommands.GeoSearchStoreCommandArgsNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisListCommands
RedisListCommands.Direction, RedisListCommands.PositionNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisServerCommands
RedisServerCommands.FlushOption, RedisServerCommands.MigrateOption, RedisServerCommands.ShutdownOptionNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisStreamCommands
RedisStreamCommands.XAddOptions, RedisStreamCommands.XClaimOptions, RedisStreamCommands.XPendingOptionsNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisStringCommands
RedisStringCommands.BitOperation, RedisStringCommands.SetOptionNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisZSetCommands
RedisZSetCommands.Limit, RedisZSetCommands.Range, RedisZSetCommands.ZAddArgs -
Constructor Summary
ConstructorsConstructorDescriptionJedisClusterConnection(redis.clients.jedis.JedisCluster cluster) Create newJedisClusterConnectionutilizing native connections viaJedisCluster.JedisClusterConnection(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor) Create newJedisClusterConnectionutilizing native connections viaJedisClusterrunning commands across the cluster via givenClusterCommandExecutor.JedisClusterConnection(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor, ClusterTopologyProvider topologyProvider) Create newJedisClusterConnectionutilizing native connections viaJedisClusterrunning commands across the cluster via givenClusterCommandExecutorand using the givenClusterTopologyProvider. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes or quits the connection.Executes the commands in the pipeline and returns their result.voidclusterAddSlots(RedisClusterNode node, int... slots) Assign slots to givenRedisClusterNode.voidclusterAddSlots(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()to givenRedisClusterNode.GetRedisGeoCommands.clusterCountKeysInSlot(int slot) Count the number of keys assigned to one slot.voidclusterDeleteSlots(RedisClusterNode node, int... slots) Remove slots fromRedisClusterNode.voidRemovesRedisClusterNode.SlotRange.getSlotsArray()from givenRedisClusterNode.voidRemove given node from cluster.Get cluster information.List<byte[]>clusterGetKeysInSlot(int slot, Integer count) Get keys served by slot.Retrieve information about masters and their connected replicas.clusterGetNodeForKey(byte[] key) Find theRedisClusterNodeserving given key.clusterGetNodeForSlot(int slot) Find theRedisClusterNodeserving given slot.Retrieve cluster node information such as id, host, port and slots.clusterGetReplicas(RedisClusterNode master) Retrieve information about connected replicas for given master node.clusterGetSlotForKey(byte[] key) Find the slot for a givenkey.voidclusterMeet(RedisClusterNode node) Add given node to cluster.voidclusterReplicate(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.voidclusterSetSlot(RedisClusterNode node, int slot, RedisClusterCommands.AddSlots mode) commands()GetRedisCommands.protected DataAccessExceptionvoiddiscard()Discard all commands issued afterRedisTxCommands.multi().byte[]echo(byte[] message) Returnsmessagevia server roundtrip.exec()Executes all queued commands in a transaction started withRedisTxCommands.multi().Native or raw execution of the given Redis command along with the given arguments.<T> Texecute(String command, byte[] key, Collection<byte[]> args) Execute the given command for thekeyprovided potentially appending args.<T> List<T>execute(String command, Collection<byte[]> keys, Collection<byte[]> args) Execute the given command for each key inkeysprovided appending allargson each invocation.GetRedisGeoCommands.protected redis.clients.jedis.JedisClusterprotected ClusterCommandExecutorredis.clients.jedis.JedisClusterReturns the native connection (the underlying library/driver object).Returns the current subscription for this connection or null if the connection is not subscribed.protected ClusterTopologyProviderGetRedisHashCommands.booleanisClosed()Indicates whether the underlying connection is closed or not.booleanIndicates whether the connection is currently pipelined or not.booleanIndicates whether the connection is in "queue"(or "MULTI") mode or not.booleanIndicates whether the current connection is subscribed (to at least one channel) or not.GetRedisKeyCommands.Set<byte[]>keys(RedisClusterNode node, byte[] pattern) GetRedisListCommands.voidmulti()Mark the start of a transaction block.voidActivates the pipeline mode for this connection.ping()Test connection.ping(RedisClusterNode node) voidpSubscribe(MessageListener listener, byte[]... patterns) Subscribes the connection to all channels matching the given patterns.publish(byte[] channel, byte[] message) Publishes the given message to the given channel.byte[]randomKey(RedisClusterNode node) voidRewrites theredis.conffile.Cursor<byte[]>scan(RedisClusterNode node, ScanOptions options) Use aCursorto iterate over keys.voidselect(int dbIndex) Select the DB with given positivedbIndex.GetRedisServerCommands.GetRedisSetCommands.GetRedisStreamCommands.GetRedisStringCommands.voidsubscribe(MessageListener listener, byte[]... channels) Subscribes the connection to the given channels.voidunwatch()Flushes all the previouslyRedisTxCommands.watch(byte[]...)keys.voidwatch(byte[]... keys) Watch givenkeysfor modifications during transaction started withRedisTxCommands.multi().GetRedisZSetCommands.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.redis.connection.DefaultedRedisClusterConnection
bgReWriteAof, bgSave, dbSize, flushAll, flushAll, flushDb, flushDb, getClientList, getConfig, info, info, lastSave, resetConfigStats, rewriteConfig, save, setConfig, shutdown, time, timeMethods inherited from interface org.springframework.data.redis.connection.DefaultedRedisConnection
append, bgReWriteAof, bgSave, bitCount, bitCount, bitField, bitOp, bitPos, bLMove, bLPop, bRPop, bRPopLPush, bZPopMax, bZPopMin, copy, dbSize, decr, decrBy, del, dump, encodingOf, eval, evalSha, evalSha, exists, exists, expire, expireAt, flushAll, flushAll, flushDb, flushDb, geoAdd, geoAdd, geoAdd, geoDist, geoDist, geoHash, geoPos, geoRadius, geoRadius, geoRadiusByMember, geoRadiusByMember, geoRemove, geoSearch, geoSearchStore, get, getBit, getClientList, getClientName, getConfig, getDel, getEx, getRange, getSet, hDel, hExists, hGet, hGetAll, hIncrBy, hIncrBy, hKeys, hLen, hMGet, hMSet, hRandField, hRandField, hRandFieldWithValues, hRandFieldWithValues, hScan, hSet, hSetNX, hStrLen, hVals, idletime, incr, incrBy, incrBy, info, info, keys, killClient, lastSave, lIndex, lInsert, lLen, lMove, lPop, lPop, lPos, lPush, lPushX, lRange, lRem, lSet, lTrim, mGet, migrate, migrate, move, mSet, mSetNX, persist, pExpire, pExpireAt, pfAdd, pfCount, pfMerge, pSetEx, pTtl, pTtl, randomKey, refcount, rename, renameNX, replicaOf, replicaOfNoOne, resetConfigStats, restore, rPop, rPop, rPopLPush, rPush, rPushX, sAdd, save, scan, sCard, scriptExists, scriptFlush, scriptKill, scriptLoad, sDiff, sDiffStore, set, set, setBit, setClientName, setConfig, setEx, setNX, setRange, shutdown, shutdown, sInter, sInterStore, sIsMember, sMembers, sMIsMember, sMove, sort, sort, sPop, sPop, sRandMember, sRandMember, sRem, sScan, strLen, sUnion, sUnionStore, time, time, touch, ttl, ttl, type, unlink, xAck, xAdd, xClaim, xClaimJustId, xDel, xGroupCreate, xGroupCreate, xGroupDelConsumer, xGroupDestroy, xInfo, xInfoConsumers, xInfoGroups, xLen, xPending, xPending, xRange, xRange, xRead, xRead, xReadGroup, xReadGroup, xRevRange, xRevRange, xTrim, xTrim, zAdd, zAdd, zCard, zCount, zCount, zDiff, zDiffStore, zDiffWithScores, zIncrBy, zInter, zInterStore, zInterStore, zInterStore, zInterWithScores, zInterWithScores, zInterWithScores, zLexCount, zMScore, zPopMax, zPopMax, zPopMin, zPopMin, zRandMember, zRandMember, zRandMemberWithScore, zRandMemberWithScore, zRange, zRangeByLex, zRangeByScore, zRangeByScore, zRangeByScore, zRangeByScoreWithScores, zRangeStoreByLex, zRangeStoreByScore, zRangeStoreRevByLex, zRangeStoreRevByScore, zRangeWithScores, zRank, zRem, zRemRange, zRemRangeByLex, zRemRangeByScore, zRemRangeByScore, zRevRange, zRevRangeByLex, zRevRangeByScore, zRevRangeByScoreWithScores, zRevRangeWithScores, zRevRank, zScan, zScore, zUnion, zUnionStore, zUnionStore, zUnionStore, zUnionWithScores, zUnionWithScores, zUnionWithScoresMethods inherited from interface org.springframework.data.redis.connection.RedisGeoCommands
geoAdd, geoRadiusByMemberMethods inherited from interface org.springframework.data.redis.connection.RedisKeyCommands
restore, scanMethods inherited from interface org.springframework.data.redis.connection.RedisListCommands
lPosMethods inherited from interface org.springframework.data.redis.connection.RedisStreamCommands
xAck, xAdd, xAdd, xClaim, xDel, xGroupDelConsumer, xPending, xPending, xPending, xPending, xPendingMethods inherited from interface org.springframework.data.redis.connection.RedisStringCommands
bitPosMethods inherited from interface org.springframework.data.redis.connection.RedisZSetCommands
zAdd, zAdd, zRangeByLex, zRangeByLex, zRangeByScore, zRangeByScore, zRangeByScore, zRangeByScoreWithScores, zRangeByScoreWithScores, zRangeByScoreWithScores, zRangeStoreByLex, zRangeStoreByScore, zRangeStoreRevByLex, zRangeStoreRevByScore, zRevRangeByLex, zRevRangeByLex, zRevRangeByScore, zRevRangeByScore, zRevRangeByScore, zRevRangeByScoreWithScores, zRevRangeByScoreWithScores, zRevRangeByScoreWithScores
-
Constructor Details
-
JedisClusterConnection
public JedisClusterConnection(redis.clients.jedis.JedisCluster cluster) Create newJedisClusterConnectionutilizing native connections viaJedisCluster.- Parameters:
cluster- must not be null.
-
JedisClusterConnection
public JedisClusterConnection(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor) Create newJedisClusterConnectionutilizing native connections viaJedisClusterrunning commands across the cluster via givenClusterCommandExecutor. UsesJedisClusterConnection.JedisClusterTopologyProviderby default.- Parameters:
cluster- must not be null.executor- must not be null.
-
JedisClusterConnection
public JedisClusterConnection(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor, ClusterTopologyProvider topologyProvider) Create newJedisClusterConnectionutilizing native connections viaJedisClusterrunning commands across the cluster via givenClusterCommandExecutorand using the givenClusterTopologyProvider.- Parameters:
cluster- must not be null.executor- must not be null.topologyProvider- must not be null.- Since:
- 2.2
-
-
Method Details
-
execute
Description copied from interface:RedisCommandsNative or raw execution of the given Redis command along with the given arguments.The command is executed as is, with as little interpretation as possible - it is up to the caller to take care of any processing of arguments or the result.
- Specified by:
executein interfaceRedisCommands- Parameters:
command- Rediscommandto execute; must not be null.args- optional array of command arguments; may be empty;- Returns:
- the execution result; may be null.
-
execute
Description copied from interface:RedisClusterConnectionExecute the given command for thekeyprovided potentially appending args.
This method, other thanRedisCommands.execute(String, byte[]...), dispatches the command to thekeyserving master node.// SET foo bar EX 10 NX execute("SET", "foo".getBytes(), asBinaryList("bar", "EX", 10, "NX"))- Specified by:
executein interfaceRedisClusterConnection- Parameters:
command- must not be null.key- must not be null.args- must not be null.- Returns:
- command result as delivered by the underlying Redis driver. Can be null.
-
execute
@Nullable public <T> List<T> execute(String command, Collection<byte[]> keys, Collection<byte[]> args) Execute the given command for each key inkeysprovided appending allargson each invocation.
This method, other thanexecute(String, byte[]...), dispatches the command to thekeyserving master node and appends thekeyas first command argument to thecommand.keysare not required to share the same slot for single-key commands. Multi-key commands carrying their keys inargsstill require to share the same slot as thekey.// SET foo bar EX 10 NX execute("SET", "foo".getBytes(), asBinaryList("bar", "EX", 10, "NX"))- Parameters:
command- must not be null.keys- must not be null.args- must not be null.- Returns:
- command result as delivered by the underlying Redis driver. Can be null.
- Since:
- 2.1
-
commands
Description copied from interface:RedisCommandsProviderGetRedisCommands.- Specified by:
commandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
clusterCommands
Description copied from interface:RedisClusterCommandsProviderGetRedisGeoCommands.- Specified by:
clusterCommandsin interfaceRedisClusterCommandsProvider- Returns:
- never null.
-
geoCommands
Description copied from interface:RedisCommandsProviderGetRedisGeoCommands.- Specified by:
geoCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
hashCommands
Description copied from interface:RedisCommandsProviderGetRedisHashCommands.- Specified by:
hashCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
hyperLogLogCommands
Description copied from interface:RedisCommandsProvider- Specified by:
hyperLogLogCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
keyCommands
Description copied from interface:RedisCommandsProviderGetRedisKeyCommands.- Specified by:
keyCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
listCommands
Description copied from interface:RedisCommandsProviderGetRedisListCommands.- Specified by:
listCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
setCommands
Description copied from interface:RedisCommandsProviderGetRedisSetCommands.- Specified by:
setCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
serverCommands
Description copied from interface:RedisCommandsProviderGetRedisServerCommands.- Specified by:
serverCommandsin interfaceRedisClusterCommandsProvider- Specified by:
serverCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
streamCommands
Description copied from interface:RedisCommandsProviderGetRedisStreamCommands.- Specified by:
streamCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
stringCommands
Description copied from interface:RedisCommandsProviderGetRedisStringCommands.- Specified by:
stringCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
zSetCommands
Description copied from interface:RedisCommandsProviderGetRedisZSetCommands.- Specified by:
zSetCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
scriptingCommands
Description copied from interface:RedisCommandsProvider- Specified by:
scriptingCommandsin interfaceRedisCommandsProvider- Returns:
- never null.
-
keys
- Specified by:
keysin interfaceRedisClusterConnection- Parameters:
node- must not be null.pattern- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
scan
Description copied from interface:RedisClusterConnectionUse aCursorto iterate over keys.- Specified by:
scanin interfaceRedisClusterConnection- Parameters:
node- must not be null.options- must not be null.- Returns:
- never null.
- See Also:
-
randomKey
- Specified by:
randomKeyin interfaceRedisClusterConnection- Parameters:
node- must not be null.- Returns:
- null when no keys stored at node or when used in pipeline / transaction.
- See Also:
-
multi
public void multi()Description copied from interface:RedisTxCommandsMark the start of a transaction block.
Commands will be queued and can then be executed by callingRedisTxCommands.exec()or rolled back usingRedisTxCommands.discard()- Specified by:
multiin interfaceRedisTxCommands- See Also:
-
exec
Description copied from interface:RedisTxCommandsExecutes all queued commands in a transaction started withRedisTxCommands.multi().
If used along withRedisTxCommands.watch(byte[]...)the operation will fail if any of watched keys has been modified.- Specified by:
execin interfaceRedisTxCommands- Returns:
- List of replies for each executed command.
- See Also:
-
discard
public void discard()Description copied from interface:RedisTxCommandsDiscard all commands issued afterRedisTxCommands.multi().- Specified by:
discardin interfaceRedisTxCommands- See Also:
-
watch
public void watch(byte[]... keys) Description copied from interface:RedisTxCommandsWatch givenkeysfor modifications during transaction started withRedisTxCommands.multi().- Specified by:
watchin interfaceRedisTxCommands- Parameters:
keys- must not be null.- See Also:
-
unwatch
public void unwatch()Description copied from interface:RedisTxCommandsFlushes all the previouslyRedisTxCommands.watch(byte[]...)keys.- Specified by:
unwatchin interfaceRedisTxCommands- See Also:
-
isSubscribed
public boolean isSubscribed()Description copied from interface:RedisPubSubCommandsIndicates whether the current connection is subscribed (to at least one channel) or not.- Specified by:
isSubscribedin interfaceRedisPubSubCommands- Returns:
- true if the connection is subscribed, false otherwise
-
getSubscription
Description copied from interface:RedisPubSubCommandsReturns the current subscription for this connection or null if the connection is not subscribed.- Specified by:
getSubscriptionin interfaceRedisPubSubCommands- Returns:
- the current subscription, null if none is available.
-
publish
Description copied from interface:RedisPubSubCommandsPublishes the given message to the given channel.- Specified by:
publishin interfaceRedisPubSubCommands- Parameters:
channel- the channel to publish to. Must not be null.message- message to publish. Must not be null.- Returns:
- the number of clients that received the message or null when used in pipeline / transaction.
- See Also:
-
subscribe
Description copied from interface:RedisPubSubCommandsSubscribes the connection to the given channels. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.Note that this operation is blocking and the current thread starts waiting for new messages immediately.
- Specified by:
subscribein interfaceRedisPubSubCommands- Parameters:
listener- message listener, must not be null.channels- channel names, must not be null.- See Also:
-
pSubscribe
Description copied from interface:RedisPubSubCommandsSubscribes the connection to all channels matching the given patterns. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.Note that this operation is blocking and the current thread starts waiting for new messages immediately.
- Specified by:
pSubscribein interfaceRedisPubSubCommands- Parameters:
listener- message listener, must not be null.patterns- channel name patterns, must not be null.- See Also:
-
select
public void select(int dbIndex) Description copied from interface:RedisConnectionCommandsSelect the DB with given positivedbIndex.- Specified by:
selectin interfaceRedisConnectionCommands- Parameters:
dbIndex- the database index.- See Also:
-
echo
public byte[] echo(byte[] message) Description copied from interface:RedisConnectionCommandsReturnsmessagevia server roundtrip.- Specified by:
echoin interfaceRedisConnectionCommands- Parameters:
message- the message to echo.- Returns:
- the message or null when used in pipeline / transaction.
- See Also:
-
ping
Description copied from interface:RedisConnectionCommandsTest connection.- Specified by:
pingin interfaceRedisConnectionCommands- Returns:
- Server response message - usually PONG. null when used in pipeline / transaction.
- See Also:
-
ping
- Specified by:
pingin interfaceRedisClusterConnection- Parameters:
node- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
clusterSetSlot
- Specified by:
clusterSetSlotin interfaceRedisClusterCommands- Parameters:
node- must not be null.mode- must not benull.- See Also:
-
clusterGetKeysInSlot
Description copied from interface:RedisClusterCommandsGet keys served by slot.- Specified by:
clusterGetKeysInSlotin interfaceRedisClusterCommandscount- must not be null.- Returns:
- See Also:
-
clusterAddSlots
Description copied from interface:RedisClusterCommandsAssign slots to givenRedisClusterNode.- Specified by:
clusterAddSlotsin interfaceRedisClusterCommands- Parameters:
node- must not be null.- See Also:
-
clusterAddSlots
Description copied from interface:RedisClusterCommandsAssignRedisClusterNode.SlotRange.getSlotsArray()to givenRedisClusterNode.- Specified by:
clusterAddSlotsin interfaceRedisClusterCommands- Parameters:
node- must not be null.range- must not be null.- See Also:
-
clusterCountKeysInSlot
Description copied from interface:RedisClusterCommandsCount the number of keys assigned to one slot.- Specified by:
clusterCountKeysInSlotin interfaceRedisClusterCommands- Returns:
- See Also:
-
clusterDeleteSlots
Description copied from interface:RedisClusterCommandsRemove slots fromRedisClusterNode.- Specified by:
clusterDeleteSlotsin interfaceRedisClusterCommands- Parameters:
node- must not be null.- See Also:
-
clusterDeleteSlotsInRange
Description copied from interface:RedisClusterCommandsRemovesRedisClusterNode.SlotRange.getSlotsArray()from givenRedisClusterNode.- Specified by:
clusterDeleteSlotsInRangein interfaceRedisClusterCommands- Parameters:
node- must not be null.range- must not be null.- See Also:
-
clusterForget
Description copied from interface:RedisClusterCommandsRemove given node from cluster.- Specified by:
clusterForgetin interfaceRedisClusterCommands- Parameters:
node- must not be null.- See Also:
-
clusterMeet
Description copied from interface:RedisClusterCommandsAdd given node to cluster.- Specified by:
clusterMeetin interfaceRedisClusterCommands- Parameters:
node- must containhostandRedisNode.getPort()and must not be null.- See Also:
-
clusterReplicate
Description copied from interface:RedisClusterCommandsAssign a replica to given master.- Specified by:
clusterReplicatein interfaceRedisClusterCommands- Parameters:
master- must not be null.replica- must not be null.- See Also:
-
clusterGetSlotForKey
Description copied from interface:RedisClusterCommandsFind the slot for a givenkey.- Specified by:
clusterGetSlotForKeyin interfaceRedisClusterCommands- Parameters:
key- must not be null.- Returns:
- See Also:
-
clusterGetNodeForKey
Description copied from interface:RedisClusterCommandsFind theRedisClusterNodeserving given key.- Specified by:
clusterGetNodeForKeyin interfaceRedisClusterCommands- Parameters:
key- must not be null.- Returns:
-
clusterGetNodeForSlot
Description copied from interface:RedisClusterCommandsFind theRedisClusterNodeserving given slot.- Specified by:
clusterGetNodeForSlotin interfaceRedisClusterCommands- Returns:
-
clusterGetNodes
Description copied from interface:RedisClusterCommandsRetrieve cluster node information such as id, host, port and slots.- Specified by:
clusterGetNodesin interfaceRedisClusterCommands- Returns:
- never null.
- See Also:
-
clusterGetReplicas
Description copied from interface:RedisClusterCommandsRetrieve information about connected replicas for given master node.- Specified by:
clusterGetReplicasin interfaceRedisClusterCommands- Parameters:
master- must not be null.- Returns:
- never null.
- See Also:
-
clusterGetMasterReplicaMap
Description copied from interface:RedisClusterCommandsRetrieve information about masters and their connected replicas.- Specified by:
clusterGetMasterReplicaMapin interfaceRedisClusterCommands- Returns:
- never null.
- See Also:
-
clusterGetClusterInfo
Description copied from interface:RedisClusterCommandsGet cluster information.- Specified by:
clusterGetClusterInfoin interfaceRedisClusterCommands- Returns:
- See Also:
-
convertJedisAccessException
-
close
Description copied from interface:RedisConnectionCloses or quits the connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRedisConnection- Throws:
DataAccessException- if theRedisConnectioncould not be closed.
-
isClosed
public boolean isClosed()Description copied from interface:RedisConnectionIndicates whether the underlying connection is closed or not.- Specified by:
isClosedin interfaceRedisConnection- Returns:
- true if the connection is closed, false otherwise.
-
getNativeConnection
public redis.clients.jedis.JedisCluster getNativeConnection()Description copied from interface:RedisConnectionReturns the native connection (the underlying library/driver object).- Specified by:
getNativeConnectionin interfaceRedisConnection- Returns:
- underlying, native object
-
isQueueing
public boolean isQueueing()Description copied from interface:RedisConnectionIndicates whether the connection is in "queue"(or "MULTI") mode or not. When queueing, all commands are postponed until EXEC or DISCARD commands are issued. Since in queueing no results are returned, the connection will return NULL on all operations that interact with the data.- Specified by:
isQueueingin interfaceRedisConnection- Returns:
- true if the connection is in queue/MULTI mode, false otherwise
-
isPipelined
public boolean isPipelined()Description copied from interface:RedisConnectionIndicates whether the connection is currently pipelined or not.- Specified by:
isPipelinedin interfaceRedisConnection- Returns:
- true if the connection is pipelined, false otherwise
- See Also:
-
openPipeline
public void openPipeline()Description copied from interface:RedisConnectionActivates the pipeline mode for this connection. When pipelined, all commands return null (the reply is read at the end throughRedisConnection.closePipeline(). Calling this method when the connection is already pipelined has no effect. Pipelining is used for issuing commands without requesting the response right away but rather at the end of the batch. While somewhat similar to MULTI, pipelining does not guarantee atomicity - it only tries to improve performance when issuing a lot of commands (such as in batching scenarios).Note:
Consider doing some performance testing before using this feature since in many cases the performance benefits are minimal yet the impact on usage are not.- Specified by:
openPipelinein interfaceRedisConnection- See Also:
-
closePipeline
Description copied from interface:RedisConnectionExecutes the commands in the pipeline and returns their result. If the connection is not pipelined, an empty collection is returned.- Specified by:
closePipelinein interfaceRedisConnection- Returns:
- the result of the executed commands.
- Throws:
RedisPipelineException- if the pipeline contains any incorrect/invalid statements
-
getSentinelConnection
- Specified by:
getSentinelConnectionin interfaceRedisConnection- Returns:
- the
RedisSentinelConnectionwhen using Redis Sentinel.
-
rewriteConfig
public void rewriteConfig()Description copied from interface:RedisServerCommandsRewrites theredis.conffile.- Specified by:
rewriteConfigin interfaceDefaultedRedisConnection- Specified by:
rewriteConfigin interfaceRedisServerCommands- See Also:
-
getCluster
protected redis.clients.jedis.JedisCluster getCluster() -
getClusterCommandExecutor
-
getTopologyProvider
-