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
Nested ClassesModifier 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
(@NonNull String key, @NonNull BitFieldSubCommands command) Get / Manipulate specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset stored at a givenkey
.bitOp
(@NonNull RedisStringCommands.BitOperation op, @NonNull String destination, @NonNull String @NonNull ... 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
(@NonNull String sourceKey, @NonNull String destinationKey, @NonNull RedisListCommands.Direction from, @NonNull 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, @NonNull String srcKey, @NonNull 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
(@NonNull String key) Get the type of internal representation used for storing the value at the givenkey
.static RecordId[]
<T> T
eval
(@NonNull String script, @NonNull ReturnType returnType, int numKeys, @NonNull String @NonNull ... keysAndArgs) Evaluate givenscript
.<T> T
evalSha
(@NonNull String scriptSha, @NonNull ReturnType returnType, int numKeys, @NonNull String @NonNull ... 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.default Boolean
Set time to live for givenkey
in seconds.expire
(@NonNull String key, long seconds, @NonNull ExpirationOptions.Condition condition) Set time to live for givenkey
in seconds.default Boolean
Set the expiration for givenkey
as a UNIX timestamp.expireAt
(@NonNull String key, long unixTime, @NonNull ExpirationOptions.Condition condition) Set the expiration for givenkey
as a UNIX timestamp.geoAdd
(@NonNull String key, @NonNull Iterable<@NonNull RedisGeoCommands.GeoLocation<String>> locations) AddRedisGeoCommands.GeoLocation
s to keyAddPoint
with given member name to key.geoAdd
(@NonNull String key, @NonNull RedisGeoCommands.GeoLocation<String> location) AddRedisGeoCommands.GeoLocation
to key.Get theDistance
between member1 and member2.geoDist
(@NonNull String key, @NonNull String member1, @NonNull String member2, @NonNull Metric metric) 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
(@NonNull String key, @NonNull Circle within, @NonNull RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the boundaries of a givenCircle
applyingRedisGeoCommands.GeoRadiusCommandArgs
.geoRadiusByMember
(@NonNull String key, @NonNull String member, double radius) Get the members within the circle defined by the members coordinates and given radius.geoRadiusByMember
(@NonNull String key, @NonNull String member, @NonNull Distance radius) Get the members within the circle defined by the members coordinates and givenDistance
.geoRadiusByMember
(@NonNull String key, @NonNull String member, @NonNull Distance radius, @NonNull RedisGeoCommands.GeoRadiusCommandArgs args) Get the members within the circle defined by the members coordinates and givenDistance
andRedisGeoCommands.GeoRadiusCommandArgs
.Remove the members.geoSearch
(@NonNull String key, @NonNull GeoReference<String> reference, @NonNull GeoShape predicate, @NonNull 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, @NonNull String key, @NonNull GeoReference<String> reference, @NonNull GeoShape predicate, @NonNull 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
(@NonNull String key, @NonNull 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.Set time to live for givenfield
in seconds.hExpire
(@NonNull String key, long seconds, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set time to live for givenfield
in seconds.Set the expiration for givenfield
as a UNIX timestamp.hExpireAt
(@NonNull String key, long unixTime, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp.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
Remove the expiration from givenfield
.Set time to live for givenfield
in milliseconds.hpExpire
(@NonNull String key, long millis, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set time to live for givenfield
in milliseconds.hpExpireAt
(@NonNull String key, long unixTimeInMillis, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp in milliseconds.hpExpireAt
(@NonNull String key, long unixTimeInMillis, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp in milliseconds.Get the time to live forfields
in seconds.hRandField
(@NonNull String key) Return a random field from the hash stored atkey
.hRandField
(@NonNull String key, long count) Return a random field from the hash stored atkey
.hRandFieldWithValues
(@NonNull String key) Return a random field from the hash along with its value stored atkey
.hRandFieldWithValues
(@NonNull String key, long count) Return a random field from the hash along with its value stored atkey
.hScan
(@NonNull 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 the time to live forfields
in seconds.Get the time to live forfields
in and convert it to the givenTimeUnit
.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
.Retrieve all keys matching the given pattern viaKEYS
command.Get element atindex
form list atkey
.lInsert
(@NonNull String key, @NonNull RedisListCommands.Position where, @NonNull String pivot, String value) Insertvalue
RedisListCommands.Position.BEFORE
orRedisListCommands.Position.AFTER
existingpivot
forkey
.Get the size of list stored atkey
.lMove
(@NonNull String sourceKey, @NonNull String destinationKey, @NonNull RedisListCommands.Direction from, @NonNull 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
(@NonNull Map<@NonNull String, String> tuple) Set multiple keys to multiple values using key-value pairs provided intuple
only if the provided key does not exist.mSetString
(@NonNull Map<@NonNull String, String> tuple) Set multiple keys to multiple values using key-value pairs provided intuple
.Remove the expiration from givenkey
.default Boolean
Set time to live for givenkey
in milliseconds.pExpire
(@NonNull String key, long millis, @NonNull ExpirationOptions.Condition condition) Set time to live for givenkey
in milliseconds.default Boolean
Set the expiration for givenkey
as a UNIX timestamp in milliseconds.pExpireAt
(@NonNull String key, long unixTimeInMillis, @NonNull ExpirationOptions.Condition condition) 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
(@NonNull MessageListener listener, @NonNull String @NonNull ... 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
(@NonNull 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
(@NonNull String key, @NonNull String value, @Nullable Expiration expiration, @Nullable 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
(@NonNull 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
(@NonNull String destKey, @NonNull String @NonNull ... keys) Intersect all given sets atkeys
and store result indestKey
.Check if set atkey
containsvalue
.Get all elements of set atkey
.sMIsMember
(@NonNull String key, String... values) Check if set atkey
contains one or morevalues
.Movevalue
fromsrcKey
todestKey
sort
(@NonNull String key, @NonNull SortParameters params) Sort the elements forkey
.sort
(@NonNull String key, @NonNull SortParameters params, @NonNull 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
(@NonNull String key) Get random element from set atkey
.sRandMember
(@NonNull String key, long count) Getcount
random elements from set atkey
.Remove givenvalues
from set atkey
and return the number of removed elements.sScan
(@NonNull String key, ScanOptions options) Use aCursor
to iterate over elements in set atkey
.Get the length of the value stored atkey
.void
subscribe
(@NonNull MessageListener listener, @NonNull String @NonNull ... 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
(@NonNull StringRecord record) Append the givenStringRecord
to the stream stored atRecord.getStream()
.xAdd
(@NonNull StringRecord record, @NonNull RedisStreamCommands.XAddOptions options) Append the givenStringRecord
to the stream stored atRecord.getStream()
.default List
<StringRecord> xClaim
(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull Duration minIdleTime, @NonNull RecordId @NonNull ... recordIds) Change the ownership of a pending message to the given new consumer.xClaim
(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull RedisStreamCommands.XClaimOptions options) Change the ownership of a pending message to the given new consumer.xClaimJustId
(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull 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
(@NonNull String key, @NonNull ReadOffset readOffset, @NonNull String group) Create a consumer group.xGroupCreate
(@NonNull String key, @NonNull ReadOffset readOffset, @NonNull String group, boolean mkStream) Create a consumer group.xGroupDelConsumer
(@NonNull String key, @NonNull Consumer consumer) Delete a consumer from a consumer group.xGroupDestroy
(@NonNull String key, String group) Destroy a consumer group.Obtain general information about the stream stored at the specified key.xInfoConsumers
(@NonNull String key, @NonNull String groupName) Obtain information about every consumer in a specific consumer group for the stream stored at the specified key.xInfoGroups
(@NonNull 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
(@NonNull String key, @NonNull String groupName, @NonNull String consumerName, @NonNull Range<String> range, @NonNull Long count) xPending
(@NonNull String key, @NonNull String groupName, @NonNull Range<String> range, @NonNull Long count) xPending
(@NonNull String key, @NonNull String groupName, @NonNull 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
(@NonNull StreamOffset<String> stream) Read records from one or moreStreamOffset
s.default List
<StringRecord> xReadAsString
(@NonNull StreamOffset<String>... streams) Read records from one or moreStreamOffset
s.default List
<StringRecord> xReadAsString
(@NonNull StreamReadOptions readOptions, @NonNull StreamOffset<String> stream) Read records from one or moreStreamOffset
s.xReadAsString
(@NonNull StreamReadOptions readOptions, @NonNull StreamOffset<String>... streams) Read records from one or moreStreamOffset
s.default List
<StringRecord> xReadGroupAsString
(@NonNull Consumer consumer, @NonNull StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.default List
<StringRecord> xReadGroupAsString
(@NonNull Consumer consumer, @NonNull StreamOffset<String> @NonNull ... streams) Read records from one or moreStreamOffset
s using a consumer group.default List
<StringRecord> xReadGroupAsString
(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull StreamOffset<String> stream) Read records from one or moreStreamOffset
s using a consumer group.xReadGroupAsString
(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull StreamOffset<String> @NonNull ... 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
(@NonNull String key, double score, String value, RedisZSetCommands.ZAddArgs args) zAdd
(@NonNull String key, Set<StringRedisConnection.StringTuple> tuples) Addtuples
to a sorted set atkey
, or update itsscore
if it already exists.zAdd
(@NonNull 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
(@NonNull String destKey, @NonNull String @NonNull ... sets) Diff sortedsets
and store result in destinationdestKey
.zDiffWithScores
(@NonNull String @NonNull ... sets) Diff sortedsets
.Increment the score of element withvalue
in sorted set byincrement
.Intersect sortedsets
.zInterStore
(@NonNull String destKey, @NonNull String @NonNull ... sets) Intersect sortedsets
and store result in destinationkey
.zInterStore
(@NonNull String destKey, @NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) Intersect sortedsets
and store result in destinationkey
.zInterWithScores
(@NonNull String @NonNull ... sets) Intersect sortedsets
.default Set
<StringRedisConnection.StringTuple> zInterWithScores
(@NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) Intersect sortedsets
.zInterWithScores
(@NonNull Aggregate aggregate, @NonNull Weights weights, @NonNull String @NonNull ... 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
(@NonNull String key) Get random element from sorted set atkey
.zRandMember
(@NonNull String key, long count) Getcount
random elements from sorted set atkey
.zRandMemberWithScore
(@NonNull String key) Get random element from sorted set atkey
.zRandMemberWithScores
(@NonNull String key, long count) Getcount
random elements from sorted set atkey
.Get elements betweenstart
andend
from sorted set.zRangeByLex
(@NonNull String key) Get all the elements in the sorted set at key in lexicographical ordering.zRangeByLex
(@NonNull String key, @NonNull Range<String> range) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.zRangeByLex
(@NonNull String key, @NonNull Range<String> range, @NonNull Limit limit) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in lexicographical ordering.zRangeByScore
(@NonNull String key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set.zRangeByScore
(@NonNull 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
(@NonNull String key, @NonNull String min, @NonNull String max) Get elements where score is betweenmin
andmax
from sorted set.zRangeByScore
(@NonNull String key, @NonNull String min, @NonNull String max, long offset, long count) Get elements in range fromstart
toend
where score is betweenmin
andmax
from sorted set.zRangeByScoreWithScores
(@NonNull String key, double min, double max) zRangeByScoreWithScores
(@NonNull String key, double min, double max, long offset, long count) default Long
zRangeStoreByLex
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range) This command is like ZRANGE , but stores the result in the dstKey destination key.zRangeStoreByLex
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range, @NonNull Limit limit) This command is like ZRANGE , but stores the result in the dstKey destination key.default Long
zRangeStoreByScore
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range) This command is like ZRANGE, but stores the result in the dstKey destination key.zRangeStoreByScore
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range, @NonNull Limit limit) This command is like ZRANGE, but stores the result in the dstKey destination key.default Long
zRangeStoreRevByLex
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range) This command is like ZRANGE … REV , but stores the result in the dstKey destination key.zRangeStoreRevByLex
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range, @NonNull Limit limit) This command is like ZRANGE … REV , but stores the result in the dstKey destination key.default Long
zRangeStoreRevByScore
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range) This command is like ZRANGE … REV, but stores the result in the dstKey destination key.zRangeStoreRevByScore
(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range, @NonNull Limit limit) This command is like ZRANGE … REV, but stores the result in the dstKey destination key.zRangeWithScores
(@NonNull 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
(@NonNull String key, @NonNull Range<String> range) Remove all elements between the lexicographicalRedisZSetCommands.Range
.zRemRangeByScore
(@NonNull 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
(@NonNull String key) Get all the elements in the sorted set at key in reversed lexicographical ordering.zRevRangeByLex
(@NonNull String key, @NonNull Range<String> range) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering.zRevRangeByLex
(@NonNull String key, @NonNull Range<String> range, @NonNull Limit limit) Get all the elements inRedisZSetCommands.Range
from the sorted set at key in reversed lexicographical ordering.zRevRangeByScore
(@NonNull String key, double min, double max) Get elements where score is betweenmin
andmax
from sorted set ordered from high to low.zRevRangeByScore
(@NonNull 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
(@NonNull String key, double min, double max) zRevRangeByScoreWithScores
(@NonNull 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
(@NonNull String key, long start, long end) Determine the index of element withvalue
in a sorted set when scored high to low.zScan
(@NonNull 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
(@NonNull String destKey, @NonNull String @NonNull ... sets) Union sortedsets
and store result in destinationkey
.zUnionStore
(@NonNull String destKey, @NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) Union sortedsets
and store result in destinationkey
.zUnionWithScores
(@NonNull String @NonNull ... sets) Union sortedsets
.default Set
<StringRedisConnection.StringTuple> zUnionWithScores
(@NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) Union sortedsets
.zUnionWithScores
(@NonNull Aggregate aggregate, @NonNull Weights weights, @NonNull String @NonNull ... sets) Union sortedsets
.Methods inherited from interface org.springframework.data.redis.connection.DefaultedRedisConnection
append, applyHashFieldExpiration, 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, expire, expireAt, 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, hExpire, hExpire, hExpireAt, hExpireAt, hGet, hGetAll, hIncrBy, hIncrBy, hKeys, hLen, hMGet, hMSet, hPersist, hpExpire, hpExpire, hpExpireAt, hpExpireAt, hpTtl, hRandField, hRandField, hRandFieldWithValues, hRandFieldWithValues, hScan, hSet, hSetNX, hStrLen, hTtl, hTtl, 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, pExpire, pExpireAt, 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, setGet, 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.RedisHashCommands
applyHashFieldExpiration, hExpire, hpExpire
Methods inherited from interface org.springframework.data.redis.connection.RedisKeyCommands
applyExpiration, expire, expireAt, pExpire, pExpireAt, 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
-
exists
-
del
-
copy
-
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
-
touch
-
keys
Retrieve all keys matching the given pattern viaKEYS
command.IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause performance issues. Consider
DefaultedRedisConnection.scan(ScanOptions)
for large datasets.- Parameters:
pattern
- must not be null.- Returns:
- See Also:
-
rename
-
renameNX
-
expire
-
expire
Set time to live for givenkey
in seconds.- Parameters:
key
- must not be null.seconds
-condition
- the condition for expiration, must not be null.- Returns:
- Since:
- 3.5
- See Also:
-
pExpire
-
pExpire
Set time to live for givenkey
in milliseconds.- Parameters:
key
- must not be null.millis
-condition
- the condition for expiration, must not be null.- Returns:
- Since:
- 3.5
- See Also:
-
expireAt
-
expireAt
Boolean expireAt(@NonNull String key, long unixTime, @NonNull ExpirationOptions.Condition condition) Set the expiration for givenkey
as a UNIX timestamp.- Parameters:
key
- must not be null.unixTime
-condition
- the condition for expiration, must not be null.- Returns:
- Since:
- 3.5
- See Also:
-
pExpireAt
-
pExpireAt
Boolean pExpireAt(@NonNull String key, long unixTimeInMillis, @NonNull ExpirationOptions.Condition condition) Set the expiration for givenkey
as a UNIX timestamp in milliseconds.- Parameters:
key
- must not be null.unixTimeInMillis
-condition
- the condition for expiration, must not be null.- Returns:
- Since:
- 3.5
- See Also:
-
persist
-
move
-
ttl
-
ttl
-
pTtl
-
pTtl
-
echo
-
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
-
getDel
-
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
-
mGet
-
set
-
set
Boolean set(@NonNull String key, @NonNull String value, @Nullable Expiration expiration, @Nullable 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
-
setEx
-
pSetEx
-
mSetString
-
mSetNXString
-
incr
-
incrBy
-
incrBy
-
decr
-
decrBy
-
append
-
getRange
-
setRange
-
getBit
-
setBit
-
bitCount
-
bitCount
-
bitOp
Long bitOp(@NonNull RedisStringCommands.BitOperation op, @NonNull String destination, @NonNull String @NonNull ... keys) 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
-
rPush
-
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
List<Long> lPos(@NonNull String key, @NonNull String element, @Nullable Integer rank, @Nullable Integer count) 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
-
rPushX
-
lPushX
-
lLen
-
lRange
-
lTrim
Trim list atkey
to elements betweenstart
andend
.- Parameters:
key
- must not be null.start
-end
-- See Also:
-
lIndex
-
lInsert
Long lInsert(@NonNull String key, @NonNull RedisListCommands.Position where, @NonNull String pivot, String value) 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
String lMove(@NonNull String sourceKey, @NonNull String destinationKey, @NonNull RedisListCommands.Direction from, @NonNull 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
String bLMove(@NonNull String sourceKey, @NonNull String destinationKey, @NonNull RedisListCommands.Direction from, @NonNull 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
-
lRem
-
lPop
-
lPop
-
rPop
-
rPop
-
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
-
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
-
sRem
-
sPop
-
sPop
-
sMove
-
sCard
-
sIsMember
-
sMIsMember
-
sInter
-
sInterStore
-
sUnion
-
sUnionStore
-
sDiff
-
sDiffStore
-
sMembers
-
sRandMember
-
sRandMember
-
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
-
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
Long zAdd(@NonNull 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
-
zIncrBy
-
zRandMember
-
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
-
zRevRank
-
zRange
-
zRangeWithScores
- Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRangeByScore
-
zRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRangeByScoreWithScores(@NonNull String key, double min, double max) - Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRangeByScore
-
zRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRangeByScoreWithScores(@NonNull String key, double min, double max, long offset, long count) - Parameters:
key
-min
-max
-offset
-count
-- Returns:
- See Also:
-
zRevRange
-
zRevRangeWithScores
Set<StringRedisConnection.StringTuple> zRevRangeWithScores(@NonNull String key, long start, long end) - Parameters:
key
- must not be null.start
-end
-- Returns:
- See Also:
-
zRevRangeByScore
-
zRevRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRevRangeByScoreWithScores(@NonNull String key, double min, double max) - Parameters:
key
- must not be null.min
-max
-- Returns:
- See Also:
-
zRevRangeByScore
-
zRevRangeByScoreWithScores
Set<StringRedisConnection.StringTuple> zRevRangeByScoreWithScores(@NonNull 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
-
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
-
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
StringRedisConnection.StringTuple bZPopMin(@NonNull String key, long timeout, @NonNull TimeUnit unit) 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
StringRedisConnection.StringTuple bZPopMax(@NonNull String key, long timeout, @NonNull TimeUnit unit) 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
-
zScore
-
zMScore
-
zRemRange
-
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
-
zDiff
-
zDiffWithScores
Diff sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zDiffStore
-
zInter
-
zInterWithScores
Intersect sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zInterWithScores
default Set<StringRedisConnection.StringTuple> zInterWithScores(@NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... 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
Set<StringRedisConnection.StringTuple> zInterWithScores(@NonNull Aggregate aggregate, @NonNull Weights weights, @NonNull String @NonNull ... 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
-
zInterStore
Long zInterStore(@NonNull String destKey, @NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) 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
-
zUnionWithScores
Union sortedsets
.- Parameters:
sets
- must not be null.- Returns:
- null when used in pipeline / transaction.
- Since:
- 2.6
- See Also:
-
zUnionWithScores
default Set<StringRedisConnection.StringTuple> zUnionWithScores(@NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... 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
Set<StringRedisConnection.StringTuple> zUnionWithScores(@NonNull Aggregate aggregate, @NonNull Weights weights, @NonNull String @NonNull ... 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
-
zUnionStore
Long zUnionStore(@NonNull String destKey, @NonNull Aggregate aggregate, int @NonNull [] weights, @NonNull String @NonNull ... sets) 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
- can be null.- Returns:
- Since:
- 1.4
- See Also:
-
zRangeByScore
-
zRangeByScore
Set<String> zRangeByScore(@NonNull String key, @NonNull String min, @NonNull String max, long offset, long count) 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
-
zRangeByLex
-
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
- must not be null.- Returns:
- Since:
- 1.6
- See Also:
-
zRevRangeByLex
-
zRevRangeByLex
-
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
default Long zRangeStoreByLex(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> 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:
-
zRangeStoreByLex
Long zRangeStoreByLex(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range, @NonNull 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:
-
zRangeStoreRevByLex
default Long zRangeStoreRevByLex(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> 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:
-
zRangeStoreRevByLex
Long zRangeStoreRevByLex(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<String> range, @NonNull 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:
-
zRangeStoreByScore
default Long zRangeStoreByScore(@NonNull String dstKey, @NonNull String srcKey, @NonNull 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
Long zRangeStoreByScore(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range, @NonNull 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
default Long zRangeStoreRevByScore(@NonNull String dstKey, @NonNull String srcKey, @NonNull 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
Long zRangeStoreRevByScore(@NonNull String dstKey, @NonNull String srcKey, @NonNull Range<? extends Number> range, @NonNull 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
-
hSetNX
-
hGet
-
hMGet
-
hMSet
-
hIncrBy
-
hIncrBy
-
hRandField
-
hRandFieldWithValues
-
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
-
hDel
-
hLen
-
hKeys
-
hVals
-
hGetAll
-
hScan
-
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
-
hExpire
Set time to live for givenfield
in seconds.- Parameters:
key
- must not be null.seconds
- the amount of time after which the key will be expired in seconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set;-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hExpire
List<Long> hExpire(@NonNull String key, long seconds, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set time to live for givenfield
in seconds.- Parameters:
key
- must not be null.seconds
- the amount of time after which the key will be expired in seconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hpExpire
Set time to live for givenfield
in milliseconds.- Parameters:
key
- must not be null.millis
- the amount of time after which the key will be expired in milliseconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set;-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hpExpire
List<Long> hpExpire(@NonNull String key, long millis, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set time to live for givenfield
in milliseconds.- Parameters:
key
- must not be null.millis
- the amount of time after which the key will be expired in milliseconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is 0;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hExpireAt
default List<Long> hExpireAt(@NonNull String key, long unixTime, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp.- Parameters:
key
- must not be null.unixTime
- the moment in time in which the field expires, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set;-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hExpireAt
List<Long> hExpireAt(@NonNull String key, long unixTime, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp.- Parameters:
key
- must not be null.unixTime
- the moment in time in which the field expires, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hpExpireAt
default List<Long> hpExpireAt(@NonNull String key, long unixTimeInMillis, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp in milliseconds.- Parameters:
key
- must not be null.unixTimeInMillis
- the moment in time in which the field expires in milliseconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set;-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hpExpireAt
List<Long> hpExpireAt(@NonNull String key, long unixTimeInMillis, @NonNull ExpirationOptions.Condition condition, @NonNull String @NonNull ... fields) Set the expiration for givenfield
as a UNIX timestamp in milliseconds.- Parameters:
key
- must not be null.unixTimeInMillis
- the moment in time in which the field expires in milliseconds, must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:2
indicating the specific field is deleted already due to expiration, or provided expiry interval is in the past;1
indicating expiration time is set/updated;0
indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met);-2
indicating there is no such field; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hPersist
Remove the expiration from givenfield
.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided:1
indicating expiration time is removed;-1
field has no expiration time to be removed;-2
indicating there is no such field; null when used in pipeline / transaction.null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hTtl
Get the time to live forfields
in seconds.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided: the time to live in milliseconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hTtl
List<Long> hTtl(@NonNull String key, @NonNull TimeUnit timeUnit, @NonNull String @NonNull ... fields) Get the time to live forfields
in and convert it to the givenTimeUnit
.- Parameters:
key
- must not be null.timeUnit
- must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided: the time to live in theTimeUnit
provided; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
hpTtl
Get the time to live forfields
in seconds.- Parameters:
key
- must not be null.fields
- must not be null.- Returns:
- a list of
Long
values for each of the fields provided: the time to live in milliseconds; or a negative value to signal an error. The command returns-1
if the key exists but has no associated expiration time. The command returns-2
if the key does not exist; null when used in pipeline / transaction. - Since:
- 3.5
- See Also:
-
pfAdd
-
pfCount
-
pfMerge
-
geoAdd
-
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
-
geoAdd
Long geoAdd(@NonNull String key, @NonNull Iterable<@NonNull RedisGeoCommands.GeoLocation<String>> locations) 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
-
geoDist
-
geoHash
-
geoPos
-
geoRadius
GeoResults<RedisGeoCommands.GeoLocation<String>> geoRadius(@NonNull String key, @NonNull Circle within) 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(@NonNull String key, @NonNull Circle within, @NonNull 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(@NonNull String key, @NonNull 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(@NonNull String key, @NonNull String member, @NonNull 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(@NonNull String key, @NonNull String member, @NonNull Distance radius, @NonNull 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
-
geoSearch
GeoResults<RedisGeoCommands.GeoLocation<String>> geoSearch(@NonNull String key, @NonNull GeoReference<String> reference, @NonNull GeoShape predicate, @NonNull 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
Long geoSearchStore(String destKey, @NonNull String key, @NonNull GeoReference<String> reference, @NonNull GeoShape predicate, @NonNull 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
-
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
<T> T eval(@NonNull String script, @NonNull ReturnType returnType, int numKeys, @NonNull String @NonNull ... keysAndArgs) Evaluate givenscript
.- Parameters:
script
- must not be null.returnType
- must not be null.numKeys
-keysAndArgs
- must not be null.- Returns:
- See Also:
-
evalSha
<T> T evalSha(@NonNull String scriptSha, @NonNull ReturnType returnType, int numKeys, @NonNull String @NonNull ... keysAndArgs) 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
default Long xAck(@NonNull String key, @NonNull String group, @NonNull String @NonNull ... entryIds) 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
-
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(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull 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(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull Duration minIdleTime, @NonNull RecordId @NonNull ... 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(@NonNull String key, @NonNull String group, @NonNull String newOwner, @NonNull 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
String xGroupCreate(@NonNull String key, @NonNull ReadOffset readOffset, @NonNull String group, boolean mkStream) 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
-
xGroupDestroy
-
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
-
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
PendingMessages xPending(@NonNull String key, @NonNull String groupName, @NonNull String consumerName, @NonNull Range<String> range, @NonNull 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
PendingMessages xPending(@NonNull String key, @NonNull String groupName, @NonNull Range<String> range, @NonNull 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.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
PendingMessages xPending(@NonNull String key, @NonNull String groupName, @NonNull 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
default List<StringRecord> xReadAsString(@NonNull StreamReadOptions readOptions, @NonNull 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
List<StringRecord> xReadAsString(@NonNull StreamReadOptions readOptions, @NonNull 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
default List<StringRecord> xReadGroupAsString(@NonNull Consumer consumer, @NonNull 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
default List<StringRecord> xReadGroupAsString(@NonNull Consumer consumer, @NonNull StreamOffset<String> @NonNull ... 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
default List<StringRecord> xReadGroupAsString(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull 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
List<StringRecord> xReadGroupAsString(@NonNull Consumer consumer, @NonNull StreamReadOptions readOptions, @NonNull StreamOffset<String> @NonNull ... 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
List<StringRecord> xRevRange(@NonNull String key, @NonNull Range<String> range, @NonNull Limit limit) 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
-
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:
-