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 voiddefault voidstatic <E> RedisList<E>create(String key, RedisOperations<String, E> operations) Constructs a new, uncappedRedisListinstance.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, uncappedDefaultRedisListinstance.static <E> RedisList<E>create(BoundListOperations<String, E> boundOps, int maxSize) Constructs a newDefaultRedisList.default EgetFirst()default EgetLast()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 thedestinationPositionargument) 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 thedestinationPositionargument) of the list stored atdestination.default EmoveFirstTo(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 thedestinationPositionargument) 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 thedestinationPositionargument) 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 thedestinationPositionargument) of the list stored atdestination.default EmoveLastTo(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 thedestinationPositionargument) of the list stored atdestination.range(long start, long end) Get elements betweenstartandendfrom list at the bound key.default Edefault Ereversed()Returns a reverse-ordered view of this collection.trim(int start, int end) Trim list at the bound key to elements betweenstartandend.trim(long start, long end) Trim list at the bound key to elements betweenstartandend.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, takeLastMethods inherited from interface java.util.concurrent.BlockingQueue
drainTo, drainTo, remainingCapacityMethods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
expire, expire, expireAt, expireAt, getExpire, getKey, getType, persist, renameMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Deque
addAll, descendingIterator, peekFirst, peekLast, pollFirst, pollLast, popMethods 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, toArrayMethods inherited from interface org.springframework.data.redis.support.collections.RedisStore
getOperations
-
Method Details
-
create
Constructs a new, uncappedRedisListinstance.- Parameters:
key- Redis key of this list.operations-RedisOperationsfor the value type of this list.- Since:
- 2.6
-
create
- Parameters:
key- Redis key of this list.operations-RedisOperationsfor the value type of this list.maxSize-Integerused to constrain the size of the list.- Since:
- 2.6
-
create
Constructs a new, uncappedDefaultRedisListinstance.- Parameters:
boundOps-BoundListOperationsfor the value type of this list.- Since:
- 2.6
-
create
Constructs a newDefaultRedisList.- Parameters:
boundOps-BoundListOperationsfor the value type of this list.maxSize-Integerconstraining 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 thedestinationPositionargument) 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 thedestinationPositionargument) of the list stored atdestination.Blocks connection until element available or
timeoutreached.- 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 thedestinationPositionargument) of the list stored atdestination.Blocks connection until element available or
timeoutreached.- 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 thedestinationPositionargument) 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 thedestinationPositionargument) of the list stored atdestination.Blocks connection until element available or
timeoutreached.- 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 thedestinationPositionargument) of the list stored atdestination.Blocks connection until element available or
timeoutreached.- 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 betweenstartandendfrom 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 betweenstartandend.- Parameters:
start-end-- See Also:
-
trim
Trim list at the bound key to elements betweenstartandend.- 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:
removeFirstin interfaceDeque<E>- Returns:
- the head of this
Deque.
-
removeLast
This method is forward-compatible with Java 21 SequencedCollections.
- Specified by:
removeLastin 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.
-