Interface StringRedisConnection
- All Superinterfaces:
AutoCloseable
,DefaultedRedisConnection
,RedisCommands
,RedisCommandsProvider
,RedisConnection
,RedisConnectionCommands
,RedisGeoCommands
,RedisHashCommands
,RedisHyperLogLogCommands
,RedisKeyCommands
,RedisListCommands
,RedisPubSubCommands
,RedisScriptingCommands
,RedisServerCommands
,RedisSetCommands
,RedisStreamCommands
,RedisStringCommands
,RedisTxCommands
,RedisZSetCommands
- All Known Implementing Classes:
DefaultStringRedisConnection
Convenience extension of
RedisConnection
that accepts and returns String
s instead of byte arrays.
Uses a RedisSerializer
underneath to perform the conversion.- Author:
- Costin Leau, Christoph Strobl, Thomas Darimont, David Liu, Mark Paluch, Ninad Divadkar, Tugdual Grall, Dengliming, Andrey Shlykov, ihaohong, Shyngys Sapraliyev
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
String-friendly ZSet tuple.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
-
Method Summary
Modifier and TypeMethodDescriptionAppend avalue
tokey
.Count the number of set bits (population counting) in value stored atkey
.Count the number of set bits (population counting) of value stored atkey
betweenstart
andend
.bitfield
(String key, BitFieldSubCommands command) Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored at a givenkey
.bitOp
(RedisStringCommands.BitOperation op, String destination, String... keys) Perform bitwise operations between strings.default Long
Return the position of the first bit set to givenbit
in a string.Return the position of the first bit set to givenbit
in a string.bLMove
(String sourceKey, String destinationKey, RedisListCommands.Direction from, RedisListCommands.Direction to, double timeout) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.Removes and returns first element from lists stored atkeys
(see:DefaultedRedisConnection.lPop(byte[])
).Removes and returns last element from lists stored atkeys
(see:DefaultedRedisConnection.rPop(byte[])
).bRPopLPush
(int timeout, String srcKey, String dstKey) Remove the last element from list atsrcKey
, append it todstKey
and return its value (seeDefaultedRedisConnection.rPopLPush(byte[], byte[])
).Remove and return the value with its score having the highest score from sorted set atkey
.Remove and return the value with its score having the lowest score from sorted set atkey
.Copy givensourceKey
totargetKey
.Decrement an integer value stored as string value ofkey
by 1.Decrement an integer value stored as string value ofkey
byvalue
.Delete givenkeys
.Returnsmessage
via server roundtrip.encodingOf
(String key) Get the type of internal representation used for storing the value at the givenkey
.static RecordId[]
<T> T
eval
(String script, ReturnType returnType, int numKeys, String... keysAndArgs) Evaluate givenscript
.<T> T
evalSha
(String scriptSha, ReturnType returnType, int numKeys, String... keysAndArgs) Evaluate givenscriptSha
.'Native' or 'raw' execution of the given command along-side the given arguments.'Native' or 'raw' execution of the given command along-side the given arguments.Determine if givenkey
exists.Count how many of the givenkeys
exist.Set time to live for givenkey
in seconds.Set the expiration for givenkey
as a UNIX timestamp.geoAdd
(String key, Iterable<RedisGeoCommands.GeoLocation<String>> locations) AddRedisGeoCommands.GeoLocation
s to keyAddPoint
with given member name to key.geoAdd
(String key, RedisGeoCommands.GeoLocation<String> location) AddRedisGeoCommands.GeoLocation
to key.Get theDistance
between member1 and member2.Get geohash representation of the position for one or more members.Get thePoint
representation of positions for one or more members.Get the members within the boundaries of a givenCircle
.geoRadius
(String key, Circle within, RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the boundaries of a givenCircle
applyingRedisGeoCommands.GeoRadiusCommandArgs
.geoRadiusByMember
(String key, String member, double radius) Get the members within the circle defined by the members coordinates and given radius.geoRadiusByMember
(String key, String member, Distance radius) Get the members within the circle defined by the members coordinates and givenDistance
.geoRadiusByMember
(String key, String member, Distance radius, RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the circle defined by the members coordinates and givenDistance
andRedisGeoCommands.GeoRadiusCommandArgs
.Remove the members.geoSearch
(String key, GeoReference<String> reference, GeoShape predicate, RedisGeoCommands.GeoSearchCommandArgs args) Return the members of a geo set which are within the borders of the area specified by a givenshape
.geoSearchStore
(String destKey, String key, GeoReference<String> reference, GeoShape predicate, RedisGeoCommands.GeoSearchStoreCommandArgs args) Query the members of a geo set which are within the borders of the area specified by a givenshape
and store the result atdestKey
.Get the value ofkey
.Get the bit value atoffset
of value atkey
.Request information and statistics about connected clients.Return the value atkey
and delete the key.getEx
(String key, Expiration expiration) Return the value atkey
and expire the key by applyingExpiration
.Get a substring of value ofkey
betweenstart
andend
.Setvalue
ofkey
and return its old value.Delete given hashfields
.Determine if given hashfield
exists.Get value for givenfield
from hash atkey
.Get entire hash stored atkey
.Incrementvalue
of a hashfield
by the givendelta
.Incrementvalue
of a hashfield
by the givendelta
.Get key set (fields) of hash atkey
.Get size of hash atkey
.Get values for givenfields
from hash atkey
.void
Set multiple hash fields to multiple values using data provided inhashes
hRandField
(String key) Return a random field from the hash stored atkey
.hRandField
(String key, long count) Return a random field from the hash stored atkey
.Return a random field from the hash along with its value stored atkey
.hRandFieldWithValues
(String key, long count) Return a random field from the hash along with its value stored atkey
.hScan
(String key, ScanOptions options) Use aCursor
to iterate over entries in hash atkey
.Set thevalue
of a hashfield
.Set thevalue
of a hashfield
only iffield
does not exist.Returns the length of the value associated withfield
in the hash stored atkey
.Get entry set (values) of hash atfield
.Get theDuration
since the object stored at the givenkey
is idle.Increment an integer value stored as string value ofkey
by 1.Increment a floating point number value ofkey
bydelta
.Increment an integer value stored ofkey
bydelta
.Find all keys matching the givenpattern
.Get element atindex
form list atkey
.lInsert
(String key, RedisListCommands.Position where, String pivot, String value) Insertvalue
RedisListCommands.Position.BEFORE
orRedisListCommands.Position.AFTER
existingpivot
forkey
.Get the size of list stored atkey
.lMove
(String sourceKey, String destinationKey, RedisListCommands.Direction from, RedisListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.Removes and returns first element in list stored atkey
.Removes and returns first elements in list stored atkey
.default Long
Returns the index of matching elements inside the list stored at given key.Returns the index of matching elements inside the list stored at given key.Prependvalues
tokey
.Prependvalues
tokey
only if the list exists.Get elements betweenstart
andend
from list atkey
.Removes the firstcount
occurrences ofvalue
from the list stored atkey
.void
Set thevalue
list element atindex
.void
Trim list atkey
to elements betweenstart
andend
.Get multiplekeys
.Move givenkey
to database withindex
.mSetNXString
(Map<String, String> tuple) Set multiple keys to multiple values using key-value pairs provided intuple
only if the provided key does not exist.mSetString
(Map<String, String> tuple) Set multiple keys to multiple values using key-value pairs provided intuple
.Remove the expiration from givenkey
.Set time to live for givenkey
in milliseconds.Set the expiration for givenkey
as a UNIX timestamp in milliseconds.Adds given values to the HyperLogLog stored at given key.Return the approximated cardinality of the structures observed by the HyperLogLog at key(s).void
Merge N different HyperLogLogs at sourceKeys into a single destinationKey.Set thevalue
and expiration inmilliseconds
forkey
.void
pSubscribe
(MessageListener listener, String... patterns) Subscribes the connection to all channels matching the given patterns.Get the precise time to live forkey
in milliseconds.Get the precise time to live forkey
in and convert it to the givenTimeUnit
.Publishes the given message to the given channel.Get the number of references of the value associated with the specifiedkey
.void
Rename keyoldKey
tonewKey
.Rename keyoldKey
tonewKey
only ifnewKey
does not exist.Removes and returns last element in list stored atkey
.Removes and returns last elements in list stored atkey
.Remove the last element from list atsrcKey
, append it todstKey
and return its value.Appendvalues
tokey
.Appendvalues
tokey
only if the list exists.Add givenvalues
to set atkey
.Get size of set atkey
.scriptLoad
(String script) Load lua script into scripts cache, without executing it.
Execute the script by callingDefaultedRedisConnection.evalSha(byte[], ReturnType, int, byte[]...)
.Diff all sets for givenkeys
.sDiffStore
(String destKey, String... keys) Diff all sets for givenkeys
and store result indestKey
.Setvalue
forkey
.set
(String key, String value, Expiration expiration, RedisStringCommands.SetOption option) Setvalue
forkey
applying timeouts fromexpiration
if set and inserting/updating values depending onoption
.Sets the bit atoffset
in value stored atkey
.void
setClientName
(String name) Assign given name to current connection.Set thevalue
and expiration inseconds
forkey
.Setvalue
forkey
, only ifkey
does not exist.void
Overwrite parts ofkey
starting at the specifiedoffset
with givenvalue
.Returns the members intersecting all given sets atkeys
.sInterStore
(String destKey, String... keys) Intersect all given sets atkeys
and store result indestKey
.Check if set atkey
containsvalue
.Get all elements of set atkey
.sMIsMember
(String key, String... values) Check if set atkey
contains one or morevalues
.Movevalue
fromsrcKey
todestKey
sort
(String key, SortParameters params) Sort the elements forkey
.sort
(String key, SortParameters params, String storeKey) Sort the elements forkey
and store result instoreKey
.Remove and return a random member from set atkey
.Remove and returncount
random members from set atkey
.sRandMember
(String key) Get random element from set atkey
.sRandMember
(String key, long count) Getcount
random elements from set atkey
.Remove givenvalues
from set atkey
and return the number of removed elements.sScan
(String key, ScanOptions options) Use aCursor
to iterate over elements in set atkey
.Get the length of the value stored atkey
.void
subscribe
(MessageListener listener, String... channels) Subscribes the connection to the given channels.Union all sets at givenkeys
.sUnionStore
(String destKey, String... keys) Union all sets at givenkeys
and store result indestKey
.Alter the last access time of givenkey(s)
.Get the time to live forkey
in seconds.Get the time to live forkey
in and convert it to the givenTimeUnit
.Determine the type stored atkey
.Unlink thekeys
from the keyspace.default Long
Acknowledge one or more record as processed.default RecordId
Append a record to the streamkey
.default RecordId
xAdd
(StringRecord record) Append the givenStringRecord
to the stream stored atRecord.getStream()
.xAdd
(StringRecord record, RedisStreamCommands.XAddOptions options) Append the givenStringRecord
to the stream stored atRecord.getStream()
.default List<StringRecord>
Change the ownership of a pending message to the given new consumer.xClaim
(String key, String group, String newOwner, RedisStreamCommands.XClaimOptions options) Change the ownership of a pending message to the given new consumer.xClaimJustId
(String key, String group, String newOwner, RedisStreamCommands.XClaimOptions options) Change the ownership of a pending message to the given new consumer without increasing the delivered count.default Long
Removes the specified entries from the stream.xGroupCreate
(String key, ReadOffset readOffset, String group) Create a consumer group.xGroupCreate
(String key, ReadOffset readOffset, String group, boolean mkStream) Create a consumer group.xGroupDelConsumer
(String key, Consumer consumer) Delete a consumer from a consumer group.xGroupDestroy
(String key, String group) Destroy a consumer group.Obtain general information about the stream stored at the specified key.xInfoConsumers
(String key, String groupName) Obtain information about every consumer in a specific consumer group for the stream stored at the specified key.xInfoGroups
(String key) Obtain information about consumer groups associated with the stream stored at the specified key.Get the length of a stream.Obtain thePendingMessagesSummary
for a given consumer group.xPending
(String key, String groupName, RedisStreamCommands.XPendingOptions options) default List<StringRecord>
Read records from a stream within a specificRedisZSetCommands.Range
.Read records from a stream within a specificRedisZSetCommands.Range
applying aLimit
.default List<StringRecord>
xReadAsString
(StreamOffset<String> stream) Read records from one or moreStreamOffset
s.default List<StringRecord>
xReadAsString
(StreamOffset<String>... streams) Read records from one or moreStreamOffset
s.default List<StringRecord>
xReadAsString
(StreamReadOptions readOptions, StreamOffset<String> stream) Read records from one or moreStreamOffset
s.xReadAsString
(StreamReadOptions readOptions, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s.default List<StringRecord>
xReadGroupAsString
(Consumer consumer, StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.default List<StringRecord>
xReadGroupAsString
(Consumer consumer, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s using a consumer group.default List<StringRecord>
xReadGroupAsString
(Consumer consumer, StreamReadOptions readOptions, StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.xReadGroupAsString
(Consumer consumer, StreamReadOptions readOptions, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s using a consumer group.default List<StringRecord>
Read records from a stream within a specificRedisZSetCommands.Range
in reverse order.Read records from a stream within a specificRedisZSetCommands.Range
applying aLimit
in reverse order.Trims the stream tocount
elements.Trims the stream tocount
elements.Addvalue
to a sorted set atkey
, or update itsscore
if it already exists.zAdd
(String key, double score, String value, RedisZSetCommands.ZAddArgs args) zAdd
(String key, Set<StringRedisConnection.StringTuple> tuples) Addtuples
to a sorted set atkey
, or update itsscore
if it already exists.zAdd
(String key, Set<StringRedisConnection.StringTuple> tuples, RedisZSetCommands.ZAddArgs args) Get the size of sorted set withkey
.Count number of elements within sorted set with scores betweenmin
andmax
.Diff sortedsets
.zDiffStore
(String destKey, String... sets) Diff sortedsets
and store result in destinationdestKey
.zDiffWithScores
(String... sets) Diff sortedsets
.Increment the score of element withvalue
in sorted set byincrement
.Intersect sortedsets
.zInterStore
(String destKey, String... sets) Intersect sortedsets
and store result in destinationkey
.zInterStore
(String destKey, Aggregate aggregate, int[] weights, String... sets) Intersect sortedsets
and store result in destinationkey
.zInterWithScores
(String... sets) Intersect sortedsets
.default Set<StringRedisConnection.StringTuple>
zInterWithScores
(Aggregate aggregate, int[] weights, String... sets) Intersect sortedsets
.zInterWithScores
(Aggregate aggregate, Weights weights, String... sets) Intersect sortedsets
.Count number of elements within sorted set with value betweenRange#min
andRange#max
applying lexicographical ordering.Get the scores of elements withvalues
from sorted set with keykey
.Remove and return the value with its score having the highest score from sorted set atkey
.Remove and returncount
values with their score having the highest score from sorted set atkey
.Remove and return the value with its score having the lowest score from sorted set atkey
.Remove and returncount
values with their score having the lowest score from sorted set atkey
.zRandMember
(String key) Get random element from sorted set atkey
.zRandMember
(String key, long count) Getcount
random elements from sorted set atkey
.Get random element from sorted set atkey
.zRandMemberWithScores
(String key, long count) Getcount
random elements from sorted set atkey
.Get elements betweenstart
andend
from sorted set.zRangeByLex
(String key) Get all the elements in the sorted set at key in lexicographical ordering.zRangeByLex
(String key, Range<String> range) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.zRangeByLex
(String key, Range<String> range, Limit limit) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.zRangeByScore
(String key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set.zRangeByScore
(String key, double min, double max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.zRangeByScore
(String key, String min, String max) Get elements where score is betweenmin
andmax
from sorted set.zRangeByScore
(String key, String min, String max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.zRangeByScoreWithScores
(String key, double min, double max) zRangeByScoreWithScores
(String key, double min, double max, long offset, long count) default Long
zRangeStoreByLex
(String dstKey, String srcKey, Range<String> range) This command is like ZRANGE , but stores the result in the dstKey destination key.This command is like ZRANGE , but stores the result in the dstKey destination key.default Long
zRangeStoreByScore
(String dstKey, String srcKey, Range<? extends Number> range) This command is like ZRANGE, but stores the result in the dstKey destination key.This command is like ZRANGE, but stores the result in the dstKey destination key.default Long
zRangeStoreRevByLex
(String dstKey, String srcKey, Range<String> range) This command is like ZRANGE … REV , but stores the result in the dstKey destination key.This command is like ZRANGE … REV , but stores the result in the dstKey destination key.default Long
zRangeStoreRevByScore
(String dstKey, String srcKey, Range<? extends Number> range) This command is like ZRANGE … REV, but stores the result in the dstKey destination key.This command is like ZRANGE … REV, but stores the result in the dstKey destination key.zRangeWithScores
(String key, long start, long end) Determine the index of element withvalue
in a sorted set.Removevalues
from sorted set.Remove elements in range betweenstart
andend
from sorted set withkey
.zRemRangeByLex
(String key, Range<String> range) Remove all elements between the lexicographicalRedisZSetCommands.Range
.zRemRangeByScore
(String key, double min, double max) Remove elements with scores betweenmin
andmax
from sorted set withkey
.Get elements in range fromstart
toend
from sorted set ordered from high to low.zRevRangeByLex
(String key) Get all the elements in the sorted set at key in reversed lexicographical ordering.zRevRangeByLex
(String key, Range<String> range) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering.zRevRangeByLex
(String key, Range<String> range, Limit limit) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering.zRevRangeByScore
(String key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set ordered from high to low.zRevRangeByScore
(String key, double min, double max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.zRevRangeByScoreWithScores
(String key, double min, double max) zRevRangeByScoreWithScores
(String key, double min, double max, long offset, long count) Get set ofTuple
in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.zRevRangeWithScores
(String key, long start, long end) Determine the index of element withvalue
in a sorted set when scored high to low.zScan
(String key, ScanOptions options) Use aCursor
to iterate over elements in sorted set atkey
.Get the score of element withvalue
from sorted set with keykey
.Union sortedsets
.zUnionStore
(String destKey, String... sets) Union sortedsets
and store result in destinationkey
.zUnionStore
(String destKey, Aggregate aggregate, int[] weights, String... sets) Union sortedsets
and store result in destinationkey
.zUnionWithScores
(String... sets) Union sortedsets
.default Set<StringRedisConnection.StringTuple>
zUnionWithScores
(Aggregate aggregate, int[] weights, String... sets) Union sortedsets
.zUnionWithScores
(Aggregate aggregate, Weights weights, String... sets) Union sortedsets
.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, 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, rewriteConfig, 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.RedisCommands
execute
Methods inherited from interface org.springframework.data.redis.connection.RedisCommandsProvider
commands, geoCommands, hashCommands, hyperLogLogCommands, keyCommands, listCommands, scriptingCommands, serverCommands, setCommands, streamCommands, stringCommands, zSetCommands
Methods inherited from interface org.springframework.data.redis.connection.RedisConnection
close, closePipeline, getNativeConnection, getSentinelConnection, isClosed, isPipelined, isQueueing, openPipeline
Methods inherited from interface org.springframework.data.redis.connection.RedisConnectionCommands
echo, ping, select
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.RedisPubSubCommands
getSubscription, isSubscribed, pSubscribe, publish, subscribe
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.RedisTxCommands
discard, exec, multi, unwatch, watch
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
-
Method Details
-
execute
'Native' or 'raw' execution of the given command along-side 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.- Parameters:
command
- Command to executeargs
- Possible command arguments (may be null)- Returns:
- execution result.
- See Also:
-
execute
'Native' or 'raw' execution of the given command along-side 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.- Parameters:
command
- Command to execute- Returns:
- execution result.
- See Also:
-
exists
Determine if givenkey
exists.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
exists
Count how many of the givenkeys
exist.- Parameters:
keys
- must not be null.- Returns:
- Since:
- 2.1
- See Also:
-
del
Delete givenkeys
.- Parameters:
keys
- must not be null.- Returns:
- The number of keys that were removed.
- See Also:
-
copy
Copy givensourceKey
totargetKey
.- Parameters:
sourceKey
- must not be null.targetKey
- must not be null.replace
- whether to replace existing keys.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
unlink
Unlink thekeys
from the keyspace. Unlike withdel(String...)
the actual memory reclaiming here happens asynchronously.- Parameters:
keys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
type
Determine the type stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
touch
Alter the last access time of givenkey(s)
.- Parameters:
keys
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
- See Also:
-
keys
Find all keys matching the givenpattern
.- Parameters:
pattern
- must not be null.- Returns:
- See Also:
-
rename
Rename keyoldKey
tonewKey
.- Parameters:
oldKey
- must not be null.newKey
- must not be null.- See Also:
-
renameNX
Rename keyoldKey
tonewKey
only ifnewKey
does not exist.- Parameters:
oldKey
- must not be null.newKey
- must not be null.- Returns:
- See Also:
-
expire
Set time to live for givenkey
in seconds.- Parameters:
key
- must not be null.seconds
-- Returns:
- See Also:
-
pExpire
Set time to live for givenkey
in milliseconds.- Parameters:
key
- must not be null.millis
-- Returns:
- See Also:
-
expireAt
Set the expiration for givenkey
as a UNIX timestamp.- Parameters:
key
- must not be null.unixTime
-- Returns:
- See Also:
-
pExpireAt
Set the expiration for givenkey
as a UNIX timestamp in milliseconds.- Parameters:
key
- must not be null.unixTimeInMillis
-- Returns:
- See Also:
-
persist
Remove the expiration from givenkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
move
Move givenkey
to database withindex
.- Parameters:
key
- must not be null.dbIndex
-- Returns:
- See Also:
-
ttl
Get the time to live forkey
in seconds.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
ttl
Get the time to live forkey
in and convert it to the givenTimeUnit
.- Parameters:
key
- must not be null.timeUnit
- must not be null.- Returns:
- Since:
- 1.8
- See Also:
-
pTtl
Get the precise time to live forkey
in milliseconds.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
pTtl
Get the precise time to live forkey
in and convert it to the givenTimeUnit
.- Parameters:
key
- must not be null.timeUnit
- must not be null.- Returns:
- Since:
- 1.8
- See Also:
-
echo
Returnsmessage
via server roundtrip.- Parameters:
message
- the message to echo.- Returns:
- See Also:
-
sort
Sort the elements forkey
.- Parameters:
key
- must not be null.params
- must not be null.- Returns:
- See Also:
-
sort
Sort the elements forkey
and store result instoreKey
.- Parameters:
key
- must not be null.params
- must not be null.storeKey
- must not be null.- Returns:
- See Also:
-
encodingOf
Get the type of internal representation used for storing the value at the givenkey
.- Parameters:
key
- must not be null.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Throws:
IllegalArgumentException
- ifkey
is null.- Since:
- 2.1
-
idletime
Get theDuration
since the object stored at the givenkey
is idle.- Parameters:
key
- must not be null.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Throws:
IllegalArgumentException
- ifkey
is null.- Since:
- 2.1
-
refcount
Get the number of references of the value associated with the specifiedkey
.- Parameters:
key
- must not be null.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Throws:
IllegalArgumentException
- ifkey
is null.- Since:
- 2.1
-
get
Get the value ofkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
getDel
Return the value atkey
and delete the key.- Parameters:
key
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getEx
Return the value atkey
and expire the key by applyingExpiration
.- Parameters:
key
- must not be null.expiration
- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
getSet
Setvalue
ofkey
and return its old value.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
mGet
Get multiplekeys
. Values are in the order of the requested keys.- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
set
Setvalue
forkey
.- Parameters:
key
- must not be null.value
- must not be null.- See Also:
-
set
@Nullable Boolean set(String key, String value, Expiration expiration, RedisStringCommands.SetOption option) Setvalue
forkey
applying timeouts fromexpiration
if set and inserting/updating values depending onoption
.- Parameters:
key
- must not be null.value
- must not be null.expiration
- can be null. Defaulted toExpiration.persistent()
. UseExpiration.keepTtl()
to keep the existing expiration.option
- can be null. Defaulted toRedisStringCommands.SetOption.UPSERT
.- Since:
- 1.7
- See Also:
-
setNX
Setvalue
forkey
, only ifkey
does not exist.- Parameters:
key
- must not be null.value
- must not be null.- Returns:
- See Also:
-
setEx
Set thevalue
and expiration inseconds
forkey
.- Parameters:
key
- must not be null.seconds
-value
- must not be null.- See Also:
-
pSetEx
Set thevalue
and expiration inmilliseconds
forkey
.- Parameters:
key
- must not be null.milliseconds
-value
- must not be null.- Since:
- 1.3
- See Also:
-
mSetString
Set multiple keys to multiple values using key-value pairs provided intuple
.- Parameters:
tuple
- must not be null.- See Also:
-
mSetNXString
Set multiple keys to multiple values using key-value pairs provided intuple
only if the provided key does not exist.- Parameters:
tuple
- must not be null.- See Also:
-
incr
Increment an integer value stored as string value ofkey
by 1.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
incrBy
Increment an integer value stored ofkey
bydelta
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
incrBy
Increment a floating point number value ofkey
bydelta
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
decr
Decrement an integer value stored as string value ofkey
by 1.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
decrBy
Decrement an integer value stored as string value ofkey
byvalue
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
append
Append avalue
tokey
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
getRange
Get a substring of value ofkey
betweenstart
andend
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
setRange
Overwrite parts ofkey
starting at the specifiedoffset
with givenvalue
.- Parameters:
key
- must not be null.value
-offset
-- See Also:
-
getBit
Get the bit value atoffset
of value atkey
.- Parameters:
key
- must not be null.offset
-- Returns:
- See Also:
-
setBit
Sets the bit atoffset
in value stored atkey
.- Parameters:
key
- must not be null.offset
-value
-- Returns:
- the original bit value stored at
offset
. - See Also:
-
bitCount
Count the number of set bits (population counting) in value stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
bitCount
Count the number of set bits (population counting) of value stored atkey
betweenstart
andend
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
bitOp
Perform bitwise operations between strings.- Parameters:
op
- must not be null.destination
- must not be null.keys
- must not be null.- Returns:
- See Also:
-
bitPos
Return the position of the first bit set to givenbit
in a string.- Parameters:
key
- the key holding the actual String.bit
- the bit value to look for.- Returns:
- null when used in pipeline / transaction. The position of the first bit set to 1 or 0 according to the request.
- Since:
- 2.1
- See Also:
-
bitPos
Return the position of the first bit set to givenbit
in a string.Range
start and end can contain negative values in order to index bytes starting from the end of the string, where -1 is the last byte, -2 is the penultimate.- Parameters:
key
- the key holding the actual String.bit
- the bit value to look for.range
- must not be null. UseRedisZSetCommands.Range.unbounded()
to not limit search.- Returns:
- null when used in pipeline / transaction. The position of the first bit set to 1 or 0 according to the request.
- Since:
- 2.1
- See Also:
-
strLen
Get the length of the value stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
rPush
Appendvalues
tokey
.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
lPos
Returns the index of matching elements inside the list stored at given key.
Requires Redis 6.0.6 or newer.- Parameters:
key
- must not be null.element
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
lPos
Returns the index of matching elements inside the list stored at given key.
Requires Redis 6.0.6 or newer.- Parameters:
key
- must not be null.element
- must not be null.rank
- specifies the "rank" of the first element to return, in case there are multiple matches. A rank of 1 means to return the first match, 2 to return the second match, and so forth.count
- number of matches to return.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
lPush
Prependvalues
tokey
.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
rPushX
Appendvalues
tokey
only if the list exists.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
lPushX
Prependvalues
tokey
only if the list exists.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
lLen
Get the size of list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
lRange
Get elements betweenstart
andend
from list atkey
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
lTrim
Trim list atkey
to elements betweenstart
andend
.- Parameters:
key
- must not be null.start
-end
-- See Also:
-
lIndex
Get element atindex
form list atkey
.- Parameters:
key
- must not be null.index
-- Returns:
- See Also:
-
lInsert
Insertvalue
RedisListCommands.Position.BEFORE
orRedisListCommands.Position.AFTER
existingpivot
forkey
.- Parameters:
key
- must not be null.where
- must not be null.pivot
-value
-- Returns:
- See Also:
-
lMove
@Nullable String lMove(String sourceKey, String destinationKey, RedisListCommands.Direction from, RedisListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.- Parameters:
sourceKey
- must not be null.destinationKey
- must not be null.from
- must not be null.to
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
bLMove
@Nullable String bLMove(String sourceKey, String destinationKey, RedisListCommands.Direction from, RedisListCommands.Direction to, double timeout) Atomically returns and removes the first/last element (head/tail depending on thefrom
argument) of the list stored atsourceKey
, and pushes the element at the first/last element (head/tail depending on theto
argument) of the list stored atdestinationKey
.- Parameters:
sourceKey
- must not be null.destinationKey
- must not be null.from
- must not be null.to
- must not be null.timeout
-- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
lSet
Set thevalue
list element atindex
.- Parameters:
key
- must not be null.index
-value
-- See Also:
-
lRem
Removes the firstcount
occurrences ofvalue
from the list stored atkey
.- Parameters:
key
- must not be null.count
-value
-- Returns:
- See Also:
-
lPop
Removes and returns first element in list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
lPop
Removes and returns first elements in list stored atkey
.- Parameters:
key
- must not be null.count
-- Returns:
- Since:
- 2.6
- See Also:
-
rPop
Removes and returns last element in list stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
rPop
Removes and returns last elements in list stored atkey
.- Parameters:
key
- must not be null.count
-- Returns:
- Since:
- 2.6
- See Also:
-
bLPop
Removes and returns first element from lists stored atkeys
(see:DefaultedRedisConnection.lPop(byte[])
).
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
-keys
- must not be null.- Returns:
- See Also:
-
bRPop
Removes and returns last element from lists stored atkeys
(see:DefaultedRedisConnection.rPop(byte[])
).
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
-keys
- must not be null.- Returns:
- See Also:
-
rPopLPush
Remove the last element from list atsrcKey
, append it todstKey
and return its value.- Parameters:
srcKey
- must not be null.dstKey
- must not be null.- Returns:
- See Also:
-
bRPopLPush
Remove the last element from list atsrcKey
, append it todstKey
and return its value (seeDefaultedRedisConnection.rPopLPush(byte[], byte[])
).
Blocks connection until element available ortimeout
reached.- Parameters:
timeout
-srcKey
- must not be null.dstKey
- must not be null.- Returns:
- See Also:
-
sAdd
Add givenvalues
to set atkey
.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
sRem
Remove givenvalues
from set atkey
and return the number of removed elements.- Parameters:
key
- must not be null.values
-- Returns:
- See Also:
-
sPop
Remove and return a random member from set atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
sPop
Remove and returncount
random members from set atkey
.- Parameters:
key
- must not be null.count
- the number of random members to return.- Returns:
- empty
List
if key does not exist. - Since:
- 2.0
- See Also:
-
sMove
Movevalue
fromsrcKey
todestKey
- Parameters:
srcKey
- must not be null.destKey
- must not be null.value
-- Returns:
- See Also:
-
sCard
Get size of set atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
sIsMember
Check if set atkey
containsvalue
.- Parameters:
key
- must not be null.value
-- Returns:
- See Also:
-
sMIsMember
Check if set atkey
contains one or morevalues
.- Parameters:
key
- must not be null.values
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
sInter
Returns the members intersecting all given sets atkeys
.- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
sInterStore
Intersect all given sets atkeys
and store result indestKey
.- Parameters:
destKey
- must not be null.keys
- must not be null.- Returns:
- See Also:
-
sUnion
Union all sets at givenkeys
.- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
sUnionStore
Union all sets at givenkeys
and store result indestKey
.- Parameters:
destKey
- must not be null.keys
- must not be null.- Returns:
- See Also:
-
sDiff
Diff all sets for givenkeys
.- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
sDiffStore
Diff all sets for givenkeys
and store result indestKey
.- Parameters:
destKey
- must not be null.keys
- must not be null.- Returns:
- See Also:
-
sMembers
Get all elements of set atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
sRandMember
Get random element from set atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
sRandMember
Getcount
random elements from set atkey
.- Parameters:
key
- must not be null.count
-- Returns:
- See Also:
-
sScan
Use aCursor
to iterate over elements in set atkey
.- Parameters:
key
- must not be null.options
- must not be null.- Returns:
- Since:
- 1.4
- See Also:
-
zAdd
Addvalue
to a sorted set atkey
, or update itsscore
if it already exists.- Parameters:
key
- must not be null.score
- the score.value
- the value.- Returns:
- See Also:
-
zAdd
- Parameters:
key
- must not be null.score
- must not be null.value
- must not be null.args
- must not be null useRedisZSetCommands.ZAddArgs.empty()
instead.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
zAdd
Addtuples
to a sorted set atkey
, or update itsscore
if it already exists.- Parameters:
key
- must not be null.tuples
- the tuples.- Returns:
- See Also:
-
zAdd
@Nullable Long zAdd(String key, Set<StringRedisConnection.StringTuple> tuples, RedisZSetCommands.ZAddArgs args) - Parameters:
key
- must not be null.tuples
- must not be null.args
- must not be null useRedisZSetCommands.ZAddArgs.empty()
instead.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
zRem
Removevalues
from sorted set. Return number of removed elements.- Parameters:
key
- must not be null.values
- must not be null.- Returns:
- See Also:
-
zIncrBy
Increment the score of element withvalue
in sorted set byincrement
.- Parameters:
key
- must not be null.increment
-value
- the value.- Returns:
- See Also:
-
zRandMember
Get random element from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
zRandMember
Getcount
random elements from sorted set atkey
.- Parameters:
key
- must not be null.count
- if the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the set size. Ifcount
is negative, the behavior changes and the command is allowed to return the same value multiple times. In this case, the number of returned values is the absolute value of the specified count.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zRandMemberWithScore
Get random element from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
zRandMemberWithScores
Getcount
random elements from sorted set atkey
.- Parameters:
key
- must not be null.count
- if the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the set size. Ifcount
is negative, the behavior changes and the command is allowed to return the same value multiple times. In this case, the number of returned values is the absolute value of the specified count.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zRank
Determine the index of element withvalue
in a sorted set.- Parameters:
key
- must not be null.value
- the value.- Returns:
- See Also:
-
zRevRank
Determine the index of element withvalue
in a sorted set when scored high to low.- Parameters:
key
- must not be null.value
- the value.- Returns:
- See Also:
-
zRange
Get elements betweenstart
andend
from sorted set.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRangeWithScores
- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRangeByScore
Get elements where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRangeByScoreWithScores
- Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRangeByScore
Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- See Also:
-
zRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRangeByScoreWithScores(String key, double min, double max, long offset, long count) - Parameters:
key
-min
-max
-offset
-count
-- Returns:
- See Also:
-
zRevRange
Get elements in range fromstart
toend
from sorted set ordered from high to low.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRevRangeWithScores
- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRevRangeByScore
Get elements where score is betweenmin
andmax
from sorted set ordered from high to low.- Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRevRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRevRangeByScoreWithScores(String key, double min, double max) - Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRevRangeByScore
Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- See Also:
-
zRevRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRevRangeByScoreWithScores(String key, double min, double max, long offset, long count) Get set ofTuple
in range fromstart
toend
where score is betweenmin
andmax
from sorted set ordered high -> low.- Parameters:
key
- must not be null.min
-max
-offset
-count
-- Returns:
- See Also:
-
zCount
Count number of elements within sorted set with scores betweenmin
andmax
.- Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zLexCount
Count number of elements within sorted set with value betweenRange#min
andRange#max
applying lexicographical ordering.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-
zPopMin
Remove and return the value with its score having the lowest score from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zPopMin
Remove and returncount
values with their score having the lowest score from sorted set atkey
.- Parameters:
key
- must not be null.count
- number of elements to pop.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
bZPopMin
Remove and return the value with its score having the lowest score from sorted set atkey
. Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
-unit
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
zPopMax
Remove and return the value with its score having the highest score from sorted set atkey
.- Parameters:
key
- must not be null.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zPopMax
Remove and returncount
values with their score having the highest score from sorted set atkey
.- Parameters:
key
- must not be null.count
- number of elements to pop.- Returns:
- null when the sorted set is empty or used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
bZPopMax
Remove and return the value with its score having the highest score from sorted set atkey
. Blocks connection until element available ortimeout
reached.- Parameters:
key
- must not be null.timeout
-unit
- must not be null.- Returns:
- can be null.
- Since:
- 2.6
- See Also:
-
zCard
Get the size of sorted set withkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
zScore
Get the score of element withvalue
from sorted set with keykey
.- Parameters:
key
- must not be null.value
- the value.- Returns:
- See Also:
-
zMScore
Get the scores of elements withvalues
from sorted set with keykey
.- Parameters:
key
- must not be null.values
- the values.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zRemRange
Remove elements in range betweenstart
andend
from sorted set withkey
.- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRemRangeByLex
Remove all elements between the lexicographicalRedisZSetCommands.Range
.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- the number of elements removed, or null when used in pipeline / transaction.
- Since:
- 2.5
- See Also:
-
zRemRangeByScore
Remove elements with scores betweenmin
andmax
from sorted set withkey
.- Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zDiff
Diff sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zDiffWithScores
Diff sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zDiffStore
Diff sortedsets
and store result in destinationdestKey
.- Parameters:
destKey
- must not be null.sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zInter
Intersect sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zInterWithScores
Intersect sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zInterWithScores
@Nullable default Set<StringRedisConnection.StringTuple> zInterWithScores(Aggregate aggregate, int[] weights, String... sets) Intersect sortedsets
.- Parameters:
aggregate
- must not be null.weights
- must not be null.sets
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
zInterWithScores
@Nullable Set<StringRedisConnection.StringTuple> zInterWithScores(Aggregate aggregate, Weights weights, String... sets) Intersect sortedsets
.- Parameters:
aggregate
- must not be null.weights
- must not be null.sets
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
zInterStore
Intersect sortedsets
and store result in destinationkey
.- Parameters:
destKey
- must not be null.sets
- must not be null.- Returns:
- See Also:
-
zInterStore
Intersect sortedsets
and store result in destinationkey
.- Parameters:
destKey
- must not be null.aggregate
- must not be null.weights
-sets
- must not be null.- Returns:
- See Also:
-
zUnion
Union sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zUnionWithScores
Union sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zUnionWithScores
@Nullable default Set<StringRedisConnection.StringTuple> zUnionWithScores(Aggregate aggregate, int[] weights, String... sets) Union sortedsets
.- Parameters:
aggregate
- must not be null.weights
- must not be null.sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zUnionWithScores
@Nullable Set<StringRedisConnection.StringTuple> zUnionWithScores(Aggregate aggregate, Weights weights, String... sets) Union sortedsets
.- Parameters:
aggregate
- must not be null.weights
- must not be null.sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zUnionStore
Union sortedsets
and store result in destinationkey
.- Parameters:
destKey
- must not be null.sets
- must not be null.- Returns:
- See Also:
-
zUnionStore
Union sortedsets
and store result in destinationkey
.- Parameters:
destKey
- must not be null.aggregate
- must not be null.weights
-sets
- must not be null.- Returns:
- See Also:
-
zScan
Use aCursor
to iterate over elements in sorted set atkey
.- Parameters:
key
- must not be null.options
- must not be null.- Returns:
- Since:
- 1.4
- See Also:
-
zRangeByScore
Get elements where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
- must not be null.max
- must not be null.- Returns:
- Since:
- 1.5
- See Also:
-
zRangeByScore
Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.- Parameters:
key
- must not be null.min
- must not be null.max
- must not be null.offset
-count
-- Returns:
- Since:
- 1.5
- See Also:
-
zRangeByLex
Get all the elements in the sorted set at key in lexicographical ordering.- Parameters:
key
- must not be null.- Returns:
- Since:
- 1.6
- See Also:
-
zRangeByLex
Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- Since:
- 1.6
- See Also:
-
zRangeByLex
Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering. Result is limited viaLimit
.- Parameters:
key
- must not be null.range
- must not be null.limit
- can be null.- Returns:
- Since:
- 1.6
- See Also:
-
zRevRangeByLex
Get all the elements in the sorted set at key in reversed lexicographical ordering.- Parameters:
key
- must not be null.- Returns:
- Since:
- 2.4
- See Also:
-
zRevRangeByLex
Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering.- Parameters:
key
- must not be null.range
- must not be null.- Returns:
- Since:
- 2.4
- See Also:
-
zRevRangeByLex
Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering. Result is limited viaLimit
.- Parameters:
key
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- Since:
- 2.4
- See Also:
-
zRangeStoreByLex
This command is like ZRANGE , but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreByLex
This command is like ZRANGE , but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreRevByLex
This command is like ZRANGE … REV , but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreRevByLex
This command is like ZRANGE … REV , but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreByScore
@Nullable default Long zRangeStoreByScore(String dstKey, String srcKey, Range<? extends Number> range) This command is like ZRANGE, but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreByScore
@Nullable Long zRangeStoreByScore(String dstKey, String srcKey, Range<? extends Number> range, Limit limit) This command is like ZRANGE, but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreRevByScore
@Nullable default Long zRangeStoreRevByScore(String dstKey, String srcKey, Range<? extends Number> range) This command is like ZRANGE … REV, but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
zRangeStoreRevByScore
@Nullable Long zRangeStoreRevByScore(String dstKey, String srcKey, Range<? extends Number> range, Limit limit) This command is like ZRANGE … REV, but stores the result in the dstKey destination key.- Parameters:
dstKey
- must not be null.srcKey
- must not be null.range
- must not be null.limit
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 3.0
- See Also:
-
hSet
Set thevalue
of a hashfield
.- Parameters:
key
- must not be null.field
- must not be null.value
-- Returns:
- See Also:
-
hSetNX
Set thevalue
of a hashfield
only iffield
does not exist.- Parameters:
key
- must not be null.field
- must not be null.value
-- Returns:
- See Also:
-
hGet
Get value for givenfield
from hash atkey
.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- See Also:
-
hMGet
Get values for givenfields
from hash atkey
.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- See Also:
-
hMSet
Set multiple hash fields to multiple values using data provided inhashes
- Parameters:
key
- must not be null.hashes
- must not be null.- See Also:
-
hIncrBy
Incrementvalue
of a hashfield
by the givendelta
.- Parameters:
key
- must not be null.field
- must not be null.delta
-- Returns:
- See Also:
-
hIncrBy
Incrementvalue
of a hashfield
by the givendelta
.- Parameters:
key
- must not be null.field
-delta
-- Returns:
- See Also:
-
hRandField
Return a random field from the hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
hRandFieldWithValues
Return a random field from the hash along with its value stored atkey
.- Parameters:
key
- must not be null.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
hRandField
Return a random field from the hash stored atkey
. If the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count.- Parameters:
key
- must not be null.count
- number of fields to return.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
hRandFieldWithValues
Return a random field from the hash along with its value stored atkey
. If the providedcount
argument is positive, return a list of distinct fields, capped either atcount
or the hash size. Ifcount
is negative, the behavior changes and the command is allowed to return the same field multiple times. In this case, the number of returned fields is the absolute value of the specified count.- Parameters:
key
- must not be null.count
- number of fields to return.- Returns:
- null if key does not exist or when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
hExists
Determine if given hashfield
exists.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- See Also:
-
hDel
Delete given hashfields
.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- See Also:
-
hLen
Get size of hash atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hKeys
Get key set (fields) of hash atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hVals
Get entry set (values) of hash atfield
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hGetAll
Get entire hash stored atkey
.- Parameters:
key
- must not be null.- Returns:
- See Also:
-
hScan
Use aCursor
to iterate over entries in hash atkey
.- Parameters:
key
- must not be null.options
- must not be null.- Returns:
- Since:
- 1.4
- See Also:
-
hStrLen
Returns the length of the value associated withfield
in the hash stored atkey
. If the key or the field do not exist,0
is returned.- Parameters:
key
- must not be null.field
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.1
-
pfAdd
Adds given values to the HyperLogLog stored at given key.- Parameters:
key
- must not be null.values
- must not be null.- Returns:
- Since:
- 1.5
- See Also:
-
pfCount
Return the approximated cardinality of the structures observed by the HyperLogLog at key(s).- Parameters:
keys
- must not be null.- Returns:
- See Also:
-
pfMerge
Merge N different HyperLogLogs at sourceKeys into a single destinationKey.- Parameters:
destinationKey
- must not be null.sourceKeys
- must not be null.- See Also:
-
geoAdd
AddPoint
with given member name to key.- Parameters:
key
- must not be null.point
- must not be null.member
- must not be null.- Returns:
- Number of elements added.
- Since:
- 1.8
- See Also:
-
geoAdd
AddRedisGeoCommands.GeoLocation
to key.- Parameters:
key
- must not be null.location
- must not be null.- Returns:
- Number of elements added.
- Since:
- 1.8
- See Also:
-
geoAdd
- Parameters:
key
- must not be null.memberCoordinateMap
- must not be null.- Returns:
- Number of elements added.
- Since:
- 1.8
- See Also:
-
geoAdd
AddRedisGeoCommands.GeoLocation
s to key- Parameters:
key
- must not be null.locations
- must not be null.- Returns:
- Number of elements added.
- Since:
- 1.8
- See Also:
-
geoDist
Get theDistance
between member1 and member2.- Parameters:
key
- must not be null.member1
- must not be null.member2
- must not be null.- Returns:
- can be null.
- Since:
- 1.8
- See Also:
-
geoDist
- Parameters:
key
- must not be null.member1
- must not be null.member2
- must not be null.metric
- must not be null.- Returns:
- can be null.
- Since:
- 1.8
- See Also:
-
geoHash
Get geohash representation of the position for one or more members.- Parameters:
key
- must not be null.members
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoPos
Get thePoint
representation of positions for one or more members.- Parameters:
key
- must not be null.members
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRadius
Get the members within the boundaries of a givenCircle
.- Parameters:
key
- must not be null.within
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRadius
GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadius(String key, Circle within, RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the boundaries of a givenCircle
applyingRedisGeoCommands.GeoRadiusCommandArgs
.- Parameters:
key
- must not be null.within
- must not be null.args
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRadiusByMember
GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadiusByMember(String key, String member, double radius) Get the members within the circle defined by the members coordinates and given radius.- Parameters:
key
- must not be null.member
- must not be null.radius
-- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRadiusByMember
GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadiusByMember(String key, String member, Distance radius) Get the members within the circle defined by the members coordinates and givenDistance
.- Parameters:
key
- must not be null.member
- must not be null.radius
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRadiusByMember
GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadiusByMember(String key, String member, Distance radius, RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the circle defined by the members coordinates and givenDistance
andRedisGeoCommands.GeoRadiusCommandArgs
.- Parameters:
key
- must not be null.member
- must not be null.radius
- must not be null.args
- must not be null.- Returns:
- never null.
- Since:
- 1.8
- See Also:
-
geoRemove
Remove the members.- Parameters:
key
- must not be null.members
- must not be null.- Returns:
- Number of members elements removed.
- Since:
- 1.8
- See Also:
-
geoSearch
@Nullable GeoResults<RedisGeoCommands.GeoLocation<String>> geoSearch(String key, GeoReference<String> reference, GeoShape predicate, RedisGeoCommands.GeoSearchCommandArgs args) Return the members of a geo set which are within the borders of the area specified by a givenshape
. The query's center point is provided byGeoReference
.- Parameters:
key
- must not be null.reference
- must not be null.predicate
- must not be null.args
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
geoSearchStore
@Nullable Long geoSearchStore(String destKey, String key, GeoReference<String> reference, GeoShape predicate, RedisGeoCommands.GeoSearchStoreCommandArgs args) Query the members of a geo set which are within the borders of the area specified by a givenshape
and store the result atdestKey
. The query's center point is provided byGeoReference
.- Parameters:
key
- must not be null.reference
- must not be null.predicate
- must not be null.args
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
publish
Publishes the given message to the given channel.- Parameters:
channel
- the channel to publish to, must not be null.message
- message to publish- Returns:
- the number of clients that received the message
- See Also:
-
subscribe
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.
- Parameters:
listener
- message listener, must not be null.channels
- channel names, must not be null.- See Also:
-
pSubscribe
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.
- Parameters:
listener
- message listener, must not be null.patterns
- channel name patterns, must not be null.- See Also:
-
scriptLoad
Load lua script into scripts cache, without executing it.
Execute the script by callingDefaultedRedisConnection.evalSha(byte[], ReturnType, int, byte[]...)
.- Parameters:
script
- must not be null.- Returns:
- See Also:
-
eval
Evaluate givenscript
.- Parameters:
script
- must not be null.returnType
- must not be null.numKeys
-keysAndArgs
- must not be null.- Returns:
- See Also:
-
evalSha
Evaluate givenscriptSha
.- Parameters:
scriptSha
- must not be null.returnType
- must not be null.numKeys
-keysAndArgs
- must not be null.- Returns:
- See Also:
-
setClientName
Assign given name to current connection.- Parameters:
name
-- Since:
- 1.3
- See Also:
-
getClientList
List<RedisClientInfo> getClientList()Request information and statistics about connected clients.- Specified by:
getClientList
in interfaceDefaultedRedisConnection
- Specified by:
getClientList
in interfaceRedisServerCommands
- Returns:
List
ofRedisClientInfo
objects.- Since:
- 1.3
- See Also:
-
bitfield
Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored at a givenkey
.- Parameters:
key
- must not be null.command
- must not be null.- Returns:
-
entryIds
-
xAck
Acknowledge one or more record as processed.- Parameters:
key
- the stream key.group
- name of the consumer group.entryIds
- record Id's to acknowledge.- Returns:
- length of acknowledged records. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xAck
-
xAdd
Append a record to the streamkey
.- Parameters:
key
- the stream key.body
- record body.- Returns:
- the record Id. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xAdd
Append the givenStringRecord
to the stream stored atRecord.getStream()
.- Parameters:
record
- must not be null.- Returns:
- the record Id. null when used in pipeline / transaction.
- Since:
- 2.2
-
xAdd
Append the givenStringRecord
to the stream stored atRecord.getStream()
.- Parameters:
record
- must not be null.options
- must not be null, useRedisStreamCommands.XAddOptions.none()
instead.- Returns:
- the record Id. null when used in pipeline / transaction.
- Since:
- 2.3
-
xClaimJustId
List<RecordId> xClaimJustId(String key, String group, String newOwner, RedisStreamCommands.XClaimOptions options) Change the ownership of a pending message to the given new consumer without increasing the delivered count.- Parameters:
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.options
- must not be null.- Returns:
- list of
ids
that changed user. - Since:
- 2.3
- See Also:
-
xClaim
default List<StringRecord> xClaim(String key, String group, String newOwner, Duration minIdleTime, RecordId... recordIds) Change the ownership of a pending message to the given new consumer.- Parameters:
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.minIdleTime
- must not be null.recordIds
- must not be null.- Returns:
- list of
StringRecord
that changed user. - Since:
- 2.3
- See Also:
-
xClaim
List<StringRecord> xClaim(String key, String group, String newOwner, RedisStreamCommands.XClaimOptions options) Change the ownership of a pending message to the given new consumer.- Parameters:
key
- the key the stream is stored at.group
- the name of the consumer group.newOwner
- the name of the new consumer.options
- must not be null.- Returns:
- list of
StringRecord
that changed user. - Since:
- 2.3
- See Also:
-
xDel
Removes the specified entries from the stream. Returns the number of items deleted, that may be different from the number of IDs passed in case certain IDs do not exist.- Parameters:
key
- the stream key.entryIds
- stream record Id's.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xDel
-
xGroupCreate
Create a consumer group.- Parameters:
key
- the stream key.readOffset
-group
- name of the consumer group.- Returns:
- true if successful. null when used in pipeline / transaction.
- Since:
- 2.2
-
xGroupCreate
Create a consumer group.- Parameters:
key
- the stream key.readOffset
-group
- name of the consumer group.mkStream
- if true the group will create the stream if needed (MKSTREAM)- Returns:
- true if successful. null when used in pipeline / transaction.
- Since:
- , 2.3
-
xGroupDelConsumer
Delete a consumer from a consumer group.- Parameters:
key
- the stream key.consumer
- consumer identified by group name and consumer key.- Returns:
- true if successful. null when used in pipeline / transaction.
- Since:
- 2.2
-
xGroupDestroy
Destroy a consumer group.- Parameters:
key
- the stream key.group
- name of the consumer group.- Returns:
- true if successful. null when used in pipeline / transaction.
- Since:
- 2.2
-
xInfo
Obtain general information about the stream stored at the specified key.- Parameters:
key
- the key the stream is stored at.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.3
-
xInfoGroups
Obtain information about consumer groups associated with the stream stored at the specified key.- Parameters:
key
- the key the stream is stored at.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.3
-
xInfoConsumers
Obtain information about every consumer in a specific consumer group for the stream stored at the specified key.- Parameters:
key
- the key the stream is stored at.groupName
- name of the consumer group.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.3
-
xLen
Get the length of a stream.- Parameters:
key
- the stream key.- Returns:
- length of the stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xPending
Obtain thePendingMessagesSummary
for a given consumer group.- Parameters:
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.- Returns:
- a summary of pending messages within the given consumer group or null when used in pipeline / transaction.
- Since:
- 2.3
- See Also:
-
xPending
@Nullable PendingMessages xPending(String key, String groupName, String consumerName, Range<String> range, Long count) - Parameters:
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.consumerName
- the name of the consumer. Must not be null.range
- the range of messages ids to search within. Must not be null.count
- limit the number of results. Must not be null.- Returns:
- pending messages for the given consumer group or null when used in pipeline / transaction.
- Since:
- 2.3
- See Also:
-
xPending
- Parameters:
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.range
- the range of messages ids to search within. Must not be null.count
- limit the number of results. Must not be null.- Returns:
- pending messages for the given consumer group or null when used in pipeline / transaction.
- Since:
- 2.3
- See Also:
-
xPending
@Nullable PendingMessages xPending(String key, String groupName, RedisStreamCommands.XPendingOptions options) - Parameters:
key
- the key the stream is stored at. Must not be null.groupName
- the name of the consumer group. Must not be null.options
- the options containing range, consumer and count. Must not be null.- Returns:
- pending messages matching given criteria or null when used in pipeline / transaction.
- Since:
- 2.3
- See Also:
-
xRange
Read records from a stream within a specificRedisZSetCommands.Range
.- Parameters:
key
- the stream key.range
- must not be null.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xRange
Read records from a stream within a specificRedisZSetCommands.Range
applying aLimit
.- Parameters:
key
- the stream key.range
- must not be null.limit
- must not be null.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadAsString
Read records from one or moreStreamOffset
s.- Parameters:
stream
- the streams to read from.- Returns:
- list ith members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadAsString
Read records from one or moreStreamOffset
s.- Parameters:
streams
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadAsString
@Nullable default List<StringRecord> xReadAsString(StreamReadOptions readOptions, StreamOffset<String> stream) Read records from one or moreStreamOffset
s.- Parameters:
readOptions
- read arguments.stream
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadAsString
@Nullable List<StringRecord> xReadAsString(StreamReadOptions readOptions, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s.- Parameters:
readOptions
- read arguments.streams
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadGroupAsString
@Nullable default List<StringRecord> xReadGroupAsString(Consumer consumer, StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.- Parameters:
consumer
- consumer/group.stream
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadGroupAsString
@Nullable default List<StringRecord> xReadGroupAsString(Consumer consumer, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s using a consumer group.- Parameters:
consumer
- consumer/group.streams
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadGroupAsString
@Nullable default List<StringRecord> xReadGroupAsString(Consumer consumer, StreamReadOptions readOptions, StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.- Parameters:
consumer
- consumer/group.readOptions
- read arguments.stream
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xReadGroupAsString
@Nullable List<StringRecord> xReadGroupAsString(Consumer consumer, StreamReadOptions readOptions, StreamOffset<String>... streams) Read records from one or moreStreamOffset
s using a consumer group.- Parameters:
consumer
- consumer/group.readOptions
- read arguments.streams
- the streams to read from.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xRevRange
Read records from a stream within a specificRedisZSetCommands.Range
in reverse order.- Parameters:
key
- the stream key.range
- must not be null.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xRevRange
Read records from a stream within a specificRedisZSetCommands.Range
applying aLimit
in reverse order.- Parameters:
key
- the stream key.range
- must not be null.limit
- must not be null.- Returns:
- list with members of the resulting stream. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xTrim
Trims the stream tocount
elements.- Parameters:
key
- the stream key.count
- length of the stream.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- Since:
- 2.2
- See Also:
-
xTrim
Trims the stream tocount
elements.- Parameters:
key
- the stream key.count
- length of the stream.approximateTrimming
- the trimming must be performed in a approximated way in order to maximize performances.- Returns:
- number of removed entries. null when used in pipeline / transaction.
- Since:
- 2.4
- See Also:
-