Package org.redisson
Class RedissonDeque<V>
- java.lang.Object
-
- org.redisson.RedissonObject
-
- org.redisson.RedissonList<V>
-
- org.redisson.RedissonQueue<V>
-
- org.redisson.RedissonDeque<V>
-
- Type Parameters:
V
- the type of elements held in this collection
- All Implemented Interfaces:
Iterable<V>
,Collection<V>
,Deque<V>
,List<V>
,Queue<V>
,RandomAccess
,RCollectionAsync<V>
,RDeque<V>
,RDequeAsync<V>
,RExpirable
,RExpirableAsync
,RList<V>
,RListAsync<V>
,RObject
,RObjectAsync
,RQueue<V>
,RQueueAsync<V>
,RSortable<List<V>>
,RSortableAsync<List<V>>
- Direct Known Subclasses:
RedissonBlockingDeque
public class RedissonDeque<V> extends RedissonQueue<V> implements RDeque<V>
Distributed and concurrent implementation ofQueue
- Author:
- Nikita Koksharov
-
-
Field Summary
-
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor
-
-
Constructor Summary
Constructors Constructor Description RedissonDeque(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
RedissonDeque(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFirst(V e)
RFuture<Void>
addFirstAsync(V e)
Adds element at the head of this deque.void
addLast(V e)
RFuture<Void>
addLastAsync(V e)
Adds element at the tail of this deque.boolean
clearExpire()
Clear an expire timeout or expire date for object.RFuture<Boolean>
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.Iterator<V>
descendingIterator()
boolean
expire(long timeToLive, TimeUnit timeUnit)
Set a timeout for object.RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit)
Set a timeout for object in async mode.boolean
expireAt(long timestamp)
Set an expire date for object.boolean
expireAt(Date timestamp)
Set an expire date for object.RFuture<Boolean>
expireAtAsync(long timestamp)
Set an expire date for object in async mode.RFuture<Boolean>
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.V
getLast()
RFuture<V>
getLastAsync()
Returns element at the tail of this deque ornull
if there are no elements in deque.boolean
offerFirst(V e)
RFuture<Boolean>
offerFirstAsync(V e)
Adds element at the head of this deque.boolean
offerLast(V e)
RFuture<Boolean>
offerLastAsync(V e)
Adds element at the tail of this deque.V
peekFirst()
RFuture<V>
peekFirstAsync()
Returns element at the head of this deque ornull
if there are no elements in deque.V
peekLast()
RFuture<V>
peekLastAsync()
Returns element at the tail of this deque ornull
if there are no elements in deque.V
pollFirst()
RFuture<V>
pollFirstAsync()
Retrieves and removes element at the head of this deque.V
pollLast()
RFuture<V>
pollLastAsync()
Retrieves and removes element at the tail of this deque.V
pop()
RFuture<V>
popAsync()
Retrieves and removes element at the head of this deque.void
push(V e)
RFuture<Void>
pushAsync(V e)
Adds element at the head of this deque.long
remainTimeToLive()
Remaining time to live of Redisson object that has a timeoutRFuture<Long>
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeoutRFuture<V>
removeFirstAsync()
Retrieves and removes the first element of deque.boolean
removeFirstOccurrence(Object o)
RFuture<Boolean>
removeFirstOccurrenceAsync(Object o)
Removes first occurrence of elemento
V
removeLast()
RFuture<V>
removeLastAsync()
Retrieves and removes the last element of deque.boolean
removeLastOccurrence(Object o)
RFuture<Boolean>
removeLastOccurrenceAsync(Object o)
Removes last occurrence of elemento
-
Methods inherited from class org.redisson.RedissonQueue
element, getFirst, offer, offerAsync, peek, peekAsync, poll, pollAsync, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, removeFirst
-
Methods inherited from class org.redisson.RedissonList
add, add, addAfter, addAfterAsync, addAll, addAll, addAllAsync, addAllAsync, addAsync, addAsync, addAsync, addBefore, addBeforeAsync, clear, contains, containsAll, containsAllAsync, containsAsync, equals, fastRemove, fastRemoveAsync, fastSet, fastSetAsync, get, get, getAsync, getAsync, hashCode, indexOf, indexOfAsync, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, lastIndexOfAsync, listIterator, listIterator, mapReduce, readAll, readAllAsync, readSort, readSort, readSort, readSort, readSort, readSort, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlpha, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAlphaAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, readSortAsync, remove, remove, remove, removeAll, removeAllAsync, removeAsync, removeAsync, removeAsync, retainAll, retainAllAsync, set, setAsync, size, sizeAsync, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, subList, toArray, toArray, toString, trim, trimAsync
-
Methods inherited from class org.redisson.RedissonObject
await, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getName, getName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, suffixName, toSeconds, touch, touchAsync, unlink, unlinkAsync
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Deque
add, addAll, contains, element, getFirst, iterator, offer, peek, poll, remove, remove, removeFirst, size
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Methods inherited from interface org.redisson.api.RCollectionAsync
addAllAsync, addAsync, containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync, sizeAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RQueue
pollLastAndOfferFirstTo, readAll
-
Methods inherited from interface org.redisson.api.RQueueAsync
offerAsync, peekAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsync
-
-
-
-
Constructor Detail
-
RedissonDeque
public RedissonDeque(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
RedissonDeque
public RedissonDeque(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
-
Method Detail
-
addFirstAsync
public RFuture<Void> addFirstAsync(V e)
Description copied from interface:RDequeAsync
Adds element at the head of this deque.- Specified by:
addFirstAsync
in interfaceRDequeAsync<V>
- Parameters:
e
- - element to add- Returns:
- void
-
addLastAsync
public RFuture<Void> addLastAsync(V e)
Description copied from interface:RDequeAsync
Adds element at the tail of this deque.- Specified by:
addLastAsync
in interfaceRDequeAsync<V>
- Parameters:
e
- - element to add- Returns:
- void
-
descendingIterator
public Iterator<V> descendingIterator()
- Specified by:
descendingIterator
in interfaceDeque<V>
-
getLastAsync
public RFuture<V> getLastAsync()
Description copied from interface:RDequeAsync
Returns element at the tail of this deque ornull
if there are no elements in deque.- Specified by:
getLastAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
offerFirst
public boolean offerFirst(V e)
- Specified by:
offerFirst
in interfaceDeque<V>
-
offerFirstAsync
public RFuture<Boolean> offerFirstAsync(V e)
Description copied from interface:RDequeAsync
Adds element at the head of this deque.- Specified by:
offerFirstAsync
in interfaceRDequeAsync<V>
- Parameters:
e
- - element to add- Returns:
true
if element was added to this deque otherwisefalse
-
offerLastAsync
public RFuture<Boolean> offerLastAsync(V e)
Description copied from interface:RDequeAsync
Adds element at the tail of this deque.- Specified by:
offerLastAsync
in interfaceRDequeAsync<V>
- Parameters:
e
- - element to add- Returns:
true
if element was added to this deque otherwisefalse
-
peekFirstAsync
public RFuture<V> peekFirstAsync()
Description copied from interface:RDequeAsync
Returns element at the head of this deque ornull
if there are no elements in deque.- Specified by:
peekFirstAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
peekLastAsync
public RFuture<V> peekLastAsync()
Description copied from interface:RDequeAsync
Returns element at the tail of this deque ornull
if there are no elements in deque.- Specified by:
peekLastAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
pollFirstAsync
public RFuture<V> pollFirstAsync()
Description copied from interface:RDequeAsync
Retrieves and removes element at the head of this deque. Returnsnull
if there are no elements in deque.- Specified by:
pollFirstAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
pollLastAsync
public RFuture<V> pollLastAsync()
Description copied from interface:RDequeAsync
Retrieves and removes element at the tail of this deque. Returnsnull
if there are no elements in deque.- Specified by:
pollLastAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
popAsync
public RFuture<V> popAsync()
Description copied from interface:RDequeAsync
Retrieves and removes element at the head of this deque. Returnsnull
if there are no elements in deque.- Specified by:
popAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
pushAsync
public RFuture<Void> pushAsync(V e)
Description copied from interface:RDequeAsync
Adds element at the head of this deque.- Specified by:
pushAsync
in interfaceRDequeAsync<V>
- Parameters:
e
- - element to add- Returns:
- void
-
removeFirstOccurrenceAsync
public RFuture<Boolean> removeFirstOccurrenceAsync(Object o)
Description copied from interface:RDequeAsync
Removes first occurrence of elemento
- Specified by:
removeFirstOccurrenceAsync
in interfaceRDequeAsync<V>
- Parameters:
o
- - element to remove- Returns:
true
if object has been removed otherwisefalse
-
removeFirstOccurrence
public boolean removeFirstOccurrence(Object o)
- Specified by:
removeFirstOccurrence
in interfaceDeque<V>
-
removeFirstAsync
public RFuture<V> removeFirstAsync()
Description copied from interface:RDequeAsync
Retrieves and removes the first element of deque. Returnsnull
if there are no elements in deque.- Specified by:
removeFirstAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
removeLastAsync
public RFuture<V> removeLastAsync()
Description copied from interface:RDequeAsync
Retrieves and removes the last element of deque. Returnsnull
if there are no elements in deque.- Specified by:
removeLastAsync
in interfaceRDequeAsync<V>
- Returns:
- element
-
removeLast
public V removeLast()
- Specified by:
removeLast
in interfaceDeque<V>
-
removeLastOccurrenceAsync
public RFuture<Boolean> removeLastOccurrenceAsync(Object o)
Description copied from interface:RDequeAsync
Removes last occurrence of elemento
- Specified by:
removeLastOccurrenceAsync
in interfaceRDequeAsync<V>
- Parameters:
o
- - element- Returns:
true
if object has been removed otherwisefalse
-
removeLastOccurrence
public boolean removeLastOccurrence(Object o)
- Specified by:
removeLastOccurrence
in interfaceDeque<V>
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirable
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsync
Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unit- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirable
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAt
in interfaceRExpirable
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsync
Set an expire date for object in async mode. When expire date comes the key will automatically be deleted.- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirable
Clear an expire timeout or expire date for object.- Specified by:
clearExpire
in interfaceRExpirable
- Returns:
true
if timeout was removedfalse
if object does not exist or does not have an associated timeout
-
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsync
Clear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
clearExpireAsync
in interfaceRExpirableAsync
- Returns:
true
if the timeout was cleared andfalse
if not
-
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirable
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLive
in interfaceRExpirable
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
remainTimeToLiveAsync
public RFuture<Long> remainTimeToLiveAsync()
Description copied from interface:RExpirableAsync
Remaining time to live of Redisson object that has a timeout- Specified by:
remainTimeToLiveAsync
in interfaceRExpirableAsync
- Returns:
- time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
-