Class ValkeyGlideListCommands
java.lang.Object
io.valkey.springframework.data.valkey.connection.valkeyglide.ValkeyGlideListCommands
- All Implemented Interfaces:
ValkeyListCommands
Implementation of
ValkeyListCommands for Valkey-Glide.- Since:
- 2.0
- Author:
- Ilia Kolominsky
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.valkey.springframework.data.valkey.connection.ValkeyListCommands
ValkeyListCommands.Direction, ValkeyListCommands.Position -
Constructor Summary
ConstructorsConstructorDescriptionValkeyGlideListCommands(ValkeyGlideConnection connection) Creates a newValkeyGlideListCommands. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bLMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to, double timeout) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.List<byte[]>bLPop(int timeout, byte[]... keys) Removes and returns first element from lists stored atkeys.List<byte[]>bRPop(int timeout, byte[]... keys) Removes and returns last element from lists stored atkeys.byte[]bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) Remove the last element from list atsrcKey, append it todstKeyand return its value.byte[]lIndex(byte[] key, long index) Get element atindexform list atkey.lInsert(byte[] key, ValkeyListCommands.Position where, byte[] pivot, byte[] value) InsertvalueValkeyListCommands.Position.BEFOREorValkeyListCommands.Position.AFTERexistingpivotforkey.lLen(byte[] key) Get the size of list stored atkey.byte[]lMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to) Atomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.byte[]lPop(byte[] key) Removes and returns first element in list stored atkey.List<byte[]>lPop(byte[] key, long count) Removes and returns first elements in list stored atkey.Returns the index of matching elements inside the list stored at given key.lPush(byte[] key, byte[]... values) Prependvaluestokey.lPushX(byte[] key, byte[] value) Prependvaluestokeyonly if the list exists.List<byte[]>lRange(byte[] key, long start, long end) Get elements betweenstartandendfrom list atkey.lRem(byte[] key, long count, byte[] value) Removes the firstcountoccurrences ofvaluefrom the list stored atkey.voidlSet(byte[] key, long index, byte[] value) Set thevaluelist element atindex.voidlTrim(byte[] key, long start, long end) Trim list atkeyto elements betweenstartandend.byte[]rPop(byte[] key) Removes and returns last element in list stored atkey.List<byte[]>rPop(byte[] key, long count) Removes and returns last elements in list stored atkey.byte[]rPopLPush(byte[] srcKey, byte[] dstKey) Remove the last element from list atsrcKey, append it todstKeyand return its value.rPush(byte[] key, byte[]... values) Appendvaluestokey.rPushX(byte[] key, byte[] value) Appendvaluestokeyonly if the list exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.valkey.springframework.data.valkey.connection.ValkeyListCommands
lPos
-
Constructor Details
-
ValkeyGlideListCommands
Creates a newValkeyGlideListCommands.- Parameters:
connection- must not be null.
-
-
Method Details
-
rPush
Description copied from interface:ValkeyListCommandsAppendvaluestokey.- Specified by:
rPushin interfaceValkeyListCommands- Parameters:
key- must not be null.values- must not be empty.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lPos
@Nullable public List<Long> lPos(byte[] key, byte[] element, @Nullable Integer rank, @Nullable Integer count) Description copied from interface:ValkeyListCommandsReturns the index of matching elements inside the list stored at given key.
Requires Valkey 6.0.6 or newer.- Specified by:
lPosin interfaceValkeyListCommands- 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.
- See Also:
-
lPush
Description copied from interface:ValkeyListCommandsPrependvaluestokey.- Specified by:
lPushin interfaceValkeyListCommands- Parameters:
key- must not be null.values- must not be empty.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
rPushX
Description copied from interface:ValkeyListCommandsAppendvaluestokeyonly if the list exists.- Specified by:
rPushXin interfaceValkeyListCommands- Parameters:
key- must not be null.value- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lPushX
Description copied from interface:ValkeyListCommandsPrependvaluestokeyonly if the list exists.- Specified by:
lPushXin interfaceValkeyListCommands- Parameters:
key- must not be null.value- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lLen
Description copied from interface:ValkeyListCommandsGet the size of list stored atkey.- Specified by:
lLenin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lRange
Description copied from interface:ValkeyListCommandsGet elements betweenstartandendfrom list atkey.- Specified by:
lRangein interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- empty
Listif key does not exists or range does not contain values. null when used in pipeline / transaction. - See Also:
-
lTrim
public void lTrim(byte[] key, long start, long end) Description copied from interface:ValkeyListCommandsTrim list atkeyto elements betweenstartandend.- Specified by:
lTrimin interfaceValkeyListCommands- Parameters:
key- must not be null.- See Also:
-
lIndex
@Nullable public byte[] lIndex(byte[] key, long index) Description copied from interface:ValkeyListCommandsGet element atindexform list atkey.- Specified by:
lIndexin interfaceValkeyListCommands- Parameters:
key- must not be null.index- zero based index value. Use negative number to designate elements starting at the tail.- Returns:
- null when index is out of range or when used in pipeline / transaction.
- See Also:
-
lInsert
@Nullable public Long lInsert(byte[] key, ValkeyListCommands.Position where, byte[] pivot, byte[] value) Description copied from interface:ValkeyListCommandsInsertvalueValkeyListCommands.Position.BEFOREorValkeyListCommands.Position.AFTERexistingpivotforkey.- Specified by:
lInsertin interfaceValkeyListCommands- Parameters:
key- must not be null.where- must not be null.pivot- must not be null.value- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lMove
@Nullable public byte[] lMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to) Description copied from interface:ValkeyListCommandsAtomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.- Specified by:
lMovein interfaceValkeyListCommands- 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.
- See Also:
-
bLMove
@Nullable public byte[] bLMove(byte[] sourceKey, byte[] destinationKey, ValkeyListCommands.Direction from, ValkeyListCommands.Direction to, double timeout) Description copied from interface:ValkeyListCommandsAtomically returns and removes the first/last element (head/tail depending on thefromargument) of the list stored atsourceKey, and pushes the element at the first/last element (head/tail depending on thetoargument) of the list stored atdestinationKey.Blocks connection until element available or
timeoutreached.- Specified by:
bLMovein interfaceValkeyListCommands- 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.
- See Also:
-
lSet
public void lSet(byte[] key, long index, byte[] value) Description copied from interface:ValkeyListCommandsSet thevaluelist element atindex.- Specified by:
lSetin interfaceValkeyListCommands- Parameters:
key- must not be null.- See Also:
-
lRem
Description copied from interface:ValkeyListCommandsRemoves the firstcountoccurrences ofvaluefrom the list stored atkey.- Specified by:
lRemin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
lPop
@Nullable public byte[] lPop(byte[] key) Description copied from interface:ValkeyListCommandsRemoves and returns first element in list stored atkey.- Specified by:
lPopin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
lPop
Description copied from interface:ValkeyListCommandsRemoves and returns first elements in list stored atkey.- Specified by:
lPopin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
rPop
@Nullable public byte[] rPop(byte[] key) Description copied from interface:ValkeyListCommandsRemoves and returns last element in list stored atkey.- Specified by:
rPopin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
rPop
Description copied from interface:ValkeyListCommandsRemoves and returns last elements in list stored atkey.- Specified by:
rPopin interfaceValkeyListCommands- Parameters:
key- must not be null.- Returns:
- null when key does not exist or used in pipeline / transaction.
- See Also:
-
bLPop
Description copied from interface:ValkeyListCommandsRemoves and returns first element from lists stored atkeys.
Blocks connection until element available ortimeoutreached.- Specified by:
bLPopin interfaceValkeyListCommands- Parameters:
timeout- seconds to block.keys- must not be null.- Returns:
- empty
Listwhen no element could be popped and the timeout was reached. null when used in pipeline / transaction. - See Also:
-
bRPop
Description copied from interface:ValkeyListCommandsRemoves and returns last element from lists stored atkeys.
Blocks connection until element available ortimeoutreached.- Specified by:
bRPopin interfaceValkeyListCommands- Parameters:
timeout- seconds to block.keys- must not be null.- Returns:
- empty
Listwhen no element could be popped and the timeout was reached. null when used in pipeline / transaction. - See Also:
-
rPopLPush
@Nullable public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) Description copied from interface:ValkeyListCommandsRemove the last element from list atsrcKey, append it todstKeyand return its value.- Specified by:
rPopLPushin interfaceValkeyListCommands- Parameters:
srcKey- must not be null.dstKey- must not be null.- Returns:
- can be null.
- See Also:
-
bRPopLPush
@Nullable public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) Description copied from interface:ValkeyListCommandsRemove the last element from list atsrcKey, append it todstKeyand return its value.
Blocks connection until element available ortimeoutreached.- Specified by:
bRPopLPushin interfaceValkeyListCommands- Parameters:
timeout- seconds to block.srcKey- must not be null.dstKey- must not be null.- Returns:
- can be null.
- See Also:
-