Interface RedisList<E>
- Type Parameters:
E
- the type of elements in this collection.
- All Superinterfaces:
BlockingDeque<E>
,BlockingQueue<E>
,BoundKeyOperations<String>
,Collection<E>
,Deque<E>
,Iterable<E>
,List<E>
,Queue<E>
,RedisCollection<E>
,RedisStore
- All Known Implementing Classes:
DefaultRedisList
List
contract. Supports List
, Queue
and Deque
contracts as
well as their equivalent blocking siblings BlockingDeque
and BlockingDeque
.- Author:
- Costin Leau, Mark Paluch, John Blum
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
default void
static <E> RedisList<E>
create
(String key, RedisOperations<String, E> operations) Constructs a new, uncappedRedisList
instance.static <E> RedisList<E>
create
(String key, RedisOperations<String, E> operations, int maxSize) static <E> RedisList<E>
create
(BoundListOperations<String, E> boundOps) Constructs a new, uncappedDefaultRedisList
instance.static <E> RedisList<E>
create
(BoundListOperations<String, E> boundOps, int maxSize) Constructs a newDefaultRedisList
.default E
getFirst()
default E
getLast()
moveFirstTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition) Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.moveFirstTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition, long timeout, TimeUnit unit) Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.default E
moveFirstTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition, Duration timeout) Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.moveLastTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition) Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.moveLastTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition, long timeout, TimeUnit unit) Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.default E
moveLastTo
(RedisList<E> destination, RedisListCommands.Direction destinationPosition, Duration timeout) Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.range
(long start, long end) Get elements betweenstart
andend
from list at the bound key.default E
default E
reversed()
Returns a reverse-ordered view of this collection.trim
(int start, int end) Trim list at the bound key to elements betweenstart
andend
.trim
(long start, long end) Trim list at the bound key to elements betweenstart
andend
.Methods inherited from interface java.util.concurrent.BlockingDeque
add, contains, element, iterator, offer, offer, offerFirst, offerFirst, offerLast, offerLast, peek, poll, poll, pollFirst, pollLast, push, put, putFirst, putLast, remove, remove, removeFirstOccurrence, removeLastOccurrence, size, take, takeFirst, takeLast
Methods inherited from interface java.util.concurrent.BlockingQueue
drainTo, drainTo, remainingCapacity
Methods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
expire, expire, expireAt, expireAt, getExpire, getKey, getType, persist, rename
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Deque
addAll, descendingIterator, peekFirst, peekLast, pollFirst, pollLast, pop
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
Methods inherited from interface org.springframework.data.redis.support.collections.RedisStore
getOperations
-
Method Details
-
create
Constructs a new, uncappedRedisList
instance.- Parameters:
key
- Redis key of this list.operations
-RedisOperations
for the value type of this list.- Since:
- 2.6
-
create
- Parameters:
key
- Redis key of this list.operations
-RedisOperations
for the value type of this list.maxSize
-Integer
used to constrain the size of the list.- Since:
- 2.6
-
create
Constructs a new, uncappedDefaultRedisList
instance.- Parameters:
boundOps
-BoundListOperations
for the value type of this list.- Since:
- 2.6
-
create
Constructs a newDefaultRedisList
.- Parameters:
boundOps
-BoundListOperations
for the value type of this list.maxSize
-Integer
constraining the size of the list.- Since:
- 2.6
-
moveFirstTo
Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
moveFirstTo
@Nullable E moveFirstTo(RedisList<E> destination, RedisListCommands.Direction destinationPosition, long timeout, TimeUnit unit) Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.Blocks connection until element available or
timeout
reached.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.timeout
-unit
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
moveFirstTo
@Nullable default E moveFirstTo(RedisList<E> destination, RedisListCommands.Direction destinationPosition, Duration timeout) Atomically returns and removes the first element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.Blocks connection until element available or
timeout
reached.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.timeout
- must not be null or negative.- Returns:
- Since:
- 2.6
- See Also:
-
moveLastTo
Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
moveLastTo
@Nullable E moveLastTo(RedisList<E> destination, RedisListCommands.Direction destinationPosition, long timeout, TimeUnit unit) Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.Blocks connection until element available or
timeout
reached.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.timeout
-unit
- must not be null.- Returns:
- Since:
- 2.6
- See Also:
-
moveLastTo
@Nullable default E moveLastTo(RedisList<E> destination, RedisListCommands.Direction destinationPosition, Duration timeout) Atomically returns and removes the last element of the list stored at the bound key, and pushes the element at the first/last element (head/tail depending on thedestinationPosition
argument) of the list stored atdestination
.Blocks connection until element available or
timeout
reached.- Parameters:
destination
- must not be null.destinationPosition
- must not be null.timeout
- must not be null or negative.- Returns:
- Since:
- 2.6
- See Also:
-
range
Get elements betweenstart
andend
from list at the bound key.- Parameters:
start
-end
-- Returns:
- null when used in pipeline / transaction.
- See Also:
-
trim
Trim list at the bound key to elements betweenstart
andend
.- Parameters:
start
-end
-- See Also:
-
trim
Trim list at the bound key to elements betweenstart
andend
.- Parameters:
start
-end
-- Since:
- 2.6
- See Also:
-
addFirst
This method is forward-compatible with Java 21 SequencedCollections.
-
addLast
This method is forward-compatible with Java 21 SequencedCollections.
-
getFirst
This method is forward-compatible with Java 21 SequencedCollections.
-
getLast
This method is forward-compatible with Java 21 SequencedCollections.
-
removeFirst
This method is forward-compatible with Java 21 SequencedCollections.
- Specified by:
removeFirst
in interfaceDeque<E>
- Returns:
- the head of this
Deque
.
-
removeLast
This method is forward-compatible with Java 21 SequencedCollections.
- Specified by:
removeLast
in interfaceDeque<E>
- Returns:
- the tail of this
Deque
.
-
reversed
Returns a reverse-ordered view of this collection.The encounter order of elements returned by the view is the inverse of the encounter order of the elements stored in this collection. The reverse ordering affects all order-sensitive operations, including any operations on further views of the returned view. If the collection implementation permits modifications to this view, the modifications "write-through" to the underlying collection. Changes to the underlying collection might or might not be visible in this reversed view, depending upon the implementation.
This method is forward-compatible with Java 21 SequencedCollections.
- Returns:
- a reverse-ordered view of this collection.
-