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
Modifier and TypeClassDescriptionprotected static interface
Jedis
specificClusterCommandExecutor.ClusterCommandCallback
.protected static class
static class
Jedis specific implementation ofClusterTopologyProvider
.protected static interface
Jedis
specificClusterCommandExecutor.MultiKeyClusterCommandCallback
.Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisClusterCommands
RedisClusterCommands.AddSlots
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisGeoCommands
RedisGeoCommands.DistanceUnit, RedisGeoCommands.GeoCommandArgs, RedisGeoCommands.GeoLocation<T>, RedisGeoCommands.GeoRadiusCommandArgs, RedisGeoCommands.GeoSearchCommandArgs, RedisGeoCommands.GeoSearchStoreCommandArgs
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisListCommands
RedisListCommands.Direction, RedisListCommands.Position
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisServerCommands
RedisServerCommands.FlushOption, RedisServerCommands.MigrateOption, RedisServerCommands.ShutdownOption
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisStreamCommands
RedisStreamCommands.XAddOptions, RedisStreamCommands.XClaimOptions, RedisStreamCommands.XPendingOptions
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisStringCommands
RedisStringCommands.BitOperation, RedisStringCommands.SetOption
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisZSetCommands
RedisZSetCommands.Limit, RedisZSetCommands.Range, RedisZSetCommands.ZAddArgs
-
Constructor Summary
ConstructorDescriptionJedisClusterConnection
(redis.clients.jedis.JedisCluster cluster) Create newJedisClusterConnection
utilizing native connections viaJedisCluster
.JedisClusterConnection
(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor) Create newJedisClusterConnection
utilizing native connections viaJedisCluster
running commands across the cluster via givenClusterCommandExecutor
.JedisClusterConnection
(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor, ClusterTopologyProvider topologyProvider) Create newJedisClusterConnection
utilizing native connections viaJedisCluster
running commands across the cluster via givenClusterCommandExecutor
and using the givenClusterTopologyProvider
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes or quits the connection.Executes the commands in the pipeline and returns their result.void
clusterAddSlots
(RedisClusterNode node, int... slots) Assign slots to givenRedisClusterNode
.void
clusterAddSlots
(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.GetRedisGeoCommands
.clusterCountKeysInSlot
(int slot) Count the number of keys assigned to one slot.void
clusterDeleteSlots
(RedisClusterNode node, int... slots) Remove slots fromRedisClusterNode
.void
RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.void
Remove 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 theRedisClusterNode
serving given key.clusterGetNodeForSlot
(int slot) Find theRedisClusterNode
serving 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
.void
clusterMeet
(RedisClusterNode node) Add given node to cluster.void
clusterReplicate
(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.void
clusterSetSlot
(RedisClusterNode node, int slot, RedisClusterCommands.AddSlots mode) commands()
GetRedisCommands
.protected DataAccessException
void
discard()
Discard all commands issued afterRedisTxCommands.multi()
.byte[]
echo
(byte[] message) Returnsmessage
via 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> T
execute
(String command, byte[] key, Collection<byte[]> args) Execute the given command for thekey
provided potentially appending args.<T> List<T>
execute
(String command, Collection<byte[]> keys, Collection<byte[]> args) Execute the given command for each key inkeys
provided appending allargs
on each invocation.GetRedisGeoCommands
.protected redis.clients.jedis.JedisCluster
protected ClusterCommandExecutor
redis.clients.jedis.JedisCluster
Returns the native connection (the underlying library/driver object).Returns the current subscription for this connection or null if the connection is not subscribed.protected ClusterTopologyProvider
GetRedisHashCommands
.boolean
isClosed()
Indicates whether the underlying connection is closed or not.boolean
Indicates whether the connection is currently pipelined or not.boolean
Indicates whether the connection is in "queue"(or "MULTI") mode or not.boolean
Indicates whether the current connection is subscribed (to at least one channel) or not.GetRedisKeyCommands
.Set<byte[]>
keys
(RedisClusterNode node, byte[] pattern) GetRedisListCommands
.void
multi()
Mark the start of a transaction block.void
Activates the pipeline mode for this connection.ping()
Test connection.ping
(RedisClusterNode node) void
pSubscribe
(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) void
Rewrites theredis.conf
file.Cursor<byte[]>
scan
(RedisClusterNode node, ScanOptions options) Use aCursor
to iterate over keys.void
select
(int dbIndex) Select the DB with given positivedbIndex
.GetRedisServerCommands
.GetRedisSetCommands
.GetRedisStreamCommands
.GetRedisStringCommands
.void
subscribe
(MessageListener listener, byte[]... channels) Subscribes the connection to the given channels.void
unwatch()
Flushes all the previouslyRedisTxCommands.watch(byte[]...)
keys.void
watch
(byte[]... keys) Watch givenkeys
for modifications during transaction started withRedisTxCommands.multi()
.GetRedisZSetCommands
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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, time
Methods 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, zUnionWithScores
Methods inherited from interface org.springframework.data.redis.connection.RedisGeoCommands
geoAdd, geoRadiusByMember
Methods inherited from interface org.springframework.data.redis.connection.RedisKeyCommands
restore, scan
Methods inherited from interface org.springframework.data.redis.connection.RedisListCommands
lPos
Methods inherited from interface org.springframework.data.redis.connection.RedisStreamCommands
xAck, xAdd, xAdd, xClaim, xDel, xGroupDelConsumer, xPending, xPending, xPending, xPending, xPending
Methods inherited from interface org.springframework.data.redis.connection.RedisStringCommands
bitPos
Methods 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 newJedisClusterConnection
utilizing native connections viaJedisCluster
.- Parameters:
cluster
- must not be null.
-
JedisClusterConnection
public JedisClusterConnection(redis.clients.jedis.JedisCluster cluster, ClusterCommandExecutor executor) Create newJedisClusterConnection
utilizing native connections viaJedisCluster
running commands across the cluster via givenClusterCommandExecutor
. UsesJedisClusterConnection.JedisClusterTopologyProvider
by 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 newJedisClusterConnection
utilizing native connections viaJedisCluster
running commands across the cluster via givenClusterCommandExecutor
and 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:RedisCommands
Native 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:
execute
in interfaceRedisCommands
- Parameters:
command
- Rediscommand
to 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:RedisClusterConnection
Execute the given command for thekey
provided potentially appending args.
This method, other thanRedisCommands.execute(String, byte[]...)
, dispatches the command to thekey
serving master node.// SET foo bar EX 10 NX execute("SET", "foo".getBytes(), asBinaryList("bar", "EX", 10, "NX"))
- Specified by:
execute
in 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 inkeys
provided appending allargs
on each invocation.
This method, other thanexecute(String, byte[]...)
, dispatches the command to thekey
serving master node and appends thekey
as first command argument to thecommand
.keys
are not required to share the same slot for single-key commands. Multi-key commands carrying their keys inargs
still 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:RedisCommandsProvider
GetRedisCommands
.- Specified by:
commands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
clusterCommands
Description copied from interface:RedisClusterCommandsProvider
GetRedisGeoCommands
.- Specified by:
clusterCommands
in interfaceRedisClusterCommandsProvider
- Returns:
- never null.
-
geoCommands
Description copied from interface:RedisCommandsProvider
GetRedisGeoCommands
.- Specified by:
geoCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
hashCommands
Description copied from interface:RedisCommandsProvider
GetRedisHashCommands
.- Specified by:
hashCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
hyperLogLogCommands
Description copied from interface:RedisCommandsProvider
- Specified by:
hyperLogLogCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
keyCommands
Description copied from interface:RedisCommandsProvider
GetRedisKeyCommands
.- Specified by:
keyCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
listCommands
Description copied from interface:RedisCommandsProvider
GetRedisListCommands
.- Specified by:
listCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
setCommands
Description copied from interface:RedisCommandsProvider
GetRedisSetCommands
.- Specified by:
setCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
serverCommands
Description copied from interface:RedisCommandsProvider
GetRedisServerCommands
.- Specified by:
serverCommands
in interfaceRedisClusterCommandsProvider
- Specified by:
serverCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
streamCommands
Description copied from interface:RedisCommandsProvider
GetRedisStreamCommands
.- Specified by:
streamCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
stringCommands
Description copied from interface:RedisCommandsProvider
GetRedisStringCommands
.- Specified by:
stringCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
zSetCommands
Description copied from interface:RedisCommandsProvider
GetRedisZSetCommands
.- Specified by:
zSetCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
scriptingCommands
Description copied from interface:RedisCommandsProvider
- Specified by:
scriptingCommands
in interfaceRedisCommandsProvider
- Returns:
- never null.
-
keys
- Specified by:
keys
in 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:RedisClusterConnection
Use aCursor
to iterate over keys.- Specified by:
scan
in interfaceRedisClusterConnection
- Parameters:
node
- must not be null.options
- must not be null.- Returns:
- never null.
- See Also:
-
randomKey
- Specified by:
randomKey
in 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:RedisTxCommands
Mark 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:
multi
in interfaceRedisTxCommands
- See Also:
-
exec
Description copied from interface:RedisTxCommands
Executes 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:
exec
in interfaceRedisTxCommands
- Returns:
- List of replies for each executed command.
- See Also:
-
discard
public void discard()Description copied from interface:RedisTxCommands
Discard all commands issued afterRedisTxCommands.multi()
.- Specified by:
discard
in interfaceRedisTxCommands
- See Also:
-
watch
public void watch(byte[]... keys) Description copied from interface:RedisTxCommands
Watch givenkeys
for modifications during transaction started withRedisTxCommands.multi()
.- Specified by:
watch
in interfaceRedisTxCommands
- Parameters:
keys
- must not be null.- See Also:
-
unwatch
public void unwatch()Description copied from interface:RedisTxCommands
Flushes all the previouslyRedisTxCommands.watch(byte[]...)
keys.- Specified by:
unwatch
in interfaceRedisTxCommands
- See Also:
-
isSubscribed
public boolean isSubscribed()Description copied from interface:RedisPubSubCommands
Indicates whether the current connection is subscribed (to at least one channel) or not.- Specified by:
isSubscribed
in interfaceRedisPubSubCommands
- Returns:
- true if the connection is subscribed, false otherwise
-
getSubscription
Description copied from interface:RedisPubSubCommands
Returns the current subscription for this connection or null if the connection is not subscribed.- Specified by:
getSubscription
in interfaceRedisPubSubCommands
- Returns:
- the current subscription, null if none is available.
-
publish
Description copied from interface:RedisPubSubCommands
Publishes the given message to the given channel.- Specified by:
publish
in 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:RedisPubSubCommands
Subscribes 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:
subscribe
in interfaceRedisPubSubCommands
- Parameters:
listener
- message listener, must not be null.channels
- channel names, must not be null.- See Also:
-
pSubscribe
Description copied from interface:RedisPubSubCommands
Subscribes 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:
pSubscribe
in 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:RedisConnectionCommands
Select the DB with given positivedbIndex
.- Specified by:
select
in interfaceRedisConnectionCommands
- Parameters:
dbIndex
- the database index.- See Also:
-
echo
public byte[] echo(byte[] message) Description copied from interface:RedisConnectionCommands
Returnsmessage
via server roundtrip.- Specified by:
echo
in interfaceRedisConnectionCommands
- Parameters:
message
- the message to echo.- Returns:
- the message or null when used in pipeline / transaction.
- See Also:
-
ping
Description copied from interface:RedisConnectionCommands
Test connection.- Specified by:
ping
in interfaceRedisConnectionCommands
- Returns:
- Server response message - usually PONG. null when used in pipeline / transaction.
- See Also:
-
ping
- Specified by:
ping
in interfaceRedisClusterConnection
- Parameters:
node
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
clusterSetSlot
- Specified by:
clusterSetSlot
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.mode
- must not benull.- See Also:
-
clusterGetKeysInSlot
Description copied from interface:RedisClusterCommands
Get keys served by slot.- Specified by:
clusterGetKeysInSlot
in interfaceRedisClusterCommands
count
- must not be null.- Returns:
- See Also:
-
clusterAddSlots
Description copied from interface:RedisClusterCommands
Assign slots to givenRedisClusterNode
.- Specified by:
clusterAddSlots
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.- See Also:
-
clusterAddSlots
Description copied from interface:RedisClusterCommands
AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.- Specified by:
clusterAddSlots
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.range
- must not be null.- See Also:
-
clusterCountKeysInSlot
Description copied from interface:RedisClusterCommands
Count the number of keys assigned to one slot.- Specified by:
clusterCountKeysInSlot
in interfaceRedisClusterCommands
- Returns:
- See Also:
-
clusterDeleteSlots
Description copied from interface:RedisClusterCommands
Remove slots fromRedisClusterNode
.- Specified by:
clusterDeleteSlots
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.- See Also:
-
clusterDeleteSlotsInRange
Description copied from interface:RedisClusterCommands
RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.- Specified by:
clusterDeleteSlotsInRange
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.range
- must not be null.- See Also:
-
clusterForget
Description copied from interface:RedisClusterCommands
Remove given node from cluster.- Specified by:
clusterForget
in interfaceRedisClusterCommands
- Parameters:
node
- must not be null.- See Also:
-
clusterMeet
Description copied from interface:RedisClusterCommands
Add given node to cluster.- Specified by:
clusterMeet
in interfaceRedisClusterCommands
- Parameters:
node
- must containhost
andRedisNode.getPort()
and must not be null.- See Also:
-
clusterReplicate
Description copied from interface:RedisClusterCommands
Assign a replica to given master.- Specified by:
clusterReplicate
in interfaceRedisClusterCommands
- Parameters:
master
- must not be null.replica
- must not be null.- See Also:
-
clusterGetSlotForKey
Description copied from interface:RedisClusterCommands
Find the slot for a givenkey
.- Specified by:
clusterGetSlotForKey
in interfaceRedisClusterCommands
- Parameters:
key
- must not be null.- Returns:
- See Also:
-
clusterGetNodeForKey
Description copied from interface:RedisClusterCommands
Find theRedisClusterNode
serving given key.- Specified by:
clusterGetNodeForKey
in interfaceRedisClusterCommands
- Parameters:
key
- must not be null.- Returns:
-
clusterGetNodeForSlot
Description copied from interface:RedisClusterCommands
Find theRedisClusterNode
serving given slot.- Specified by:
clusterGetNodeForSlot
in interfaceRedisClusterCommands
- Returns:
-
clusterGetNodes
Description copied from interface:RedisClusterCommands
Retrieve cluster node information such as id, host, port and slots.- Specified by:
clusterGetNodes
in interfaceRedisClusterCommands
- Returns:
- never null.
- See Also:
-
clusterGetReplicas
Description copied from interface:RedisClusterCommands
Retrieve information about connected replicas for given master node.- Specified by:
clusterGetReplicas
in interfaceRedisClusterCommands
- Parameters:
master
- must not be null.- Returns:
- never null.
- See Also:
-
clusterGetMasterReplicaMap
Description copied from interface:RedisClusterCommands
Retrieve information about masters and their connected replicas.- Specified by:
clusterGetMasterReplicaMap
in interfaceRedisClusterCommands
- Returns:
- never null.
- See Also:
-
clusterGetClusterInfo
Description copied from interface:RedisClusterCommands
Get cluster information.- Specified by:
clusterGetClusterInfo
in interfaceRedisClusterCommands
- Returns:
- See Also:
-
convertJedisAccessException
-
close
Description copied from interface:RedisConnection
Closes or quits the connection.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceRedisConnection
- Throws:
DataAccessException
- if theRedisConnection
could not be closed.
-
isClosed
public boolean isClosed()Description copied from interface:RedisConnection
Indicates whether the underlying connection is closed or not.- Specified by:
isClosed
in interfaceRedisConnection
- Returns:
- true if the connection is closed, false otherwise.
-
getNativeConnection
public redis.clients.jedis.JedisCluster getNativeConnection()Description copied from interface:RedisConnection
Returns the native connection (the underlying library/driver object).- Specified by:
getNativeConnection
in interfaceRedisConnection
- Returns:
- underlying, native object
-
isQueueing
public boolean isQueueing()Description copied from interface:RedisConnection
Indicates 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:
isQueueing
in interfaceRedisConnection
- Returns:
- true if the connection is in queue/MULTI mode, false otherwise
-
isPipelined
public boolean isPipelined()Description copied from interface:RedisConnection
Indicates whether the connection is currently pipelined or not.- Specified by:
isPipelined
in interfaceRedisConnection
- Returns:
- true if the connection is pipelined, false otherwise
- See Also:
-
openPipeline
public void openPipeline()Description copied from interface:RedisConnection
Activates 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:
openPipeline
in interfaceRedisConnection
- See Also:
-
closePipeline
Description copied from interface:RedisConnection
Executes the commands in the pipeline and returns their result. If the connection is not pipelined, an empty collection is returned.- Specified by:
closePipeline
in interfaceRedisConnection
- Returns:
- the result of the executed commands.
- Throws:
RedisPipelineException
- if the pipeline contains any incorrect/invalid statements
-
getSentinelConnection
- Specified by:
getSentinelConnection
in interfaceRedisConnection
- Returns:
- the
RedisSentinelConnection
when using Redis Sentinel.
-
rewriteConfig
public void rewriteConfig()Description copied from interface:RedisServerCommands
Rewrites theredis.conf
file.- Specified by:
rewriteConfig
in interfaceDefaultedRedisConnection
- Specified by:
rewriteConfig
in interfaceRedisServerCommands
- See Also:
-
getCluster
protected redis.clients.jedis.JedisCluster getCluster() -
getClusterCommandExecutor
-
getTopologyProvider
-