Interface RedisList<E>
- 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
Redis extension for the
List contract. Supports List, Queue and Deque contracts as
well as their equivalent blocking siblings BlockingDeque and BlockingDeque.- Author:
- Costin Leau, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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) Constructs a newRedisListinstance.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 newDefaultRedisListinstance.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.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, addFirst, addLast, 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, getFirst, getLast, peekFirst, peekLast, pollFirst, pollLast, pop, removeFirst, removeLastMethods 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
Constructs a newRedisListinstance.- Parameters:
key- Redis key of this list.operations-RedisOperationsfor the value type of this list.maxSize-- Since:
- 2.6
-
create
Constructs a new, uncappedDefaultRedisListinstance.- Parameters:
boundOps-BoundListOperationsfor the value type of this list.- Since:
- 2.6
-
create
Constructs a newDefaultRedisListinstance.- Parameters:
boundOps-BoundListOperationsfor the value type of this list.maxSize-- 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 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:
-
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:
-
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 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:
-
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:
-
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:
-