Package org.redisson
Class RedissonPriorityDeque<V>
- java.lang.Object
-
- org.redisson.RedissonObject
-
- org.redisson.RedissonList<V>
-
- org.redisson.RedissonPriorityQueue<V>
-
- org.redisson.RedissonPriorityDeque<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
,RPriorityDeque<V>
,RPriorityQueue<V>
,RQueue<V>
,RQueueAsync<V>
,RSortable<List<V>>
,RSortableAsync<List<V>>
- Direct Known Subclasses:
RedissonPriorityBlockingDeque
public class RedissonPriorityDeque<V> extends RedissonPriorityQueue<V> implements RPriorityDeque<V>
Distributed and concurrent implementation ofQueue
- Author:
- Nikita Koksharov
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.redisson.RedissonPriorityQueue
RedissonPriorityQueue.BinarySearchResult<V>
-
-
Field Summary
-
Fields inherited from class org.redisson.RedissonObject
codec, name
-
-
Constructor Summary
Constructors Modifier Constructor Description RedissonPriorityDeque(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
protected
RedissonPriorityDeque(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFirst(V e)
int
addFirst(V... elements)
Adds elements at the head of deque.RFuture<Void>
addFirstAsync(V e)
Adds element at the head of this deque.RFuture<Integer>
addFirstAsync(V... elements)
Adds elements at the head of deque.int
addFirstIfExists(V... elements)
Adds element at the head of existing deque.RFuture<Integer>
addFirstIfExistsAsync(V... elements)
Adds element at the head of existing deque.void
addLast(V e)
int
addLast(V... elements)
Adds elements at the tail of deque.RFuture<Void>
addLastAsync(V e)
Adds element at the tail of this deque.RFuture<Integer>
addLastAsync(V... elements)
Adds elements at the tail of deque.int
addLastIfExists(V... elements)
Adds element at the tail of existing deque.RFuture<Integer>
addLastIfExistsAsync(V... elements)
Adds element at the tail of existing deque.boolean
clearExpire()
Clear an expire timeout or expire date for object.protected RFuture<Boolean>
clearExpireAsync(String... keys)
Iterator<V>
descendingIterator()
Stream<V>
descendingStream()
Returns stream of elements contained in this deque in reverse orderboolean
expire(long timeToLive, TimeUnit timeUnit)
UseRExpirable.expire(Duration)
insteadboolean
expire(Duration duration)
Sets a timeout for this object.boolean
expire(Instant instant)
Sets an expiration date for this object.RFuture<Boolean>
expireAsync(long timeToLive, TimeUnit timeUnit)
UseRExpirableAsync.expireAsync(Duration)
insteadRFuture<Boolean>
expireAsync(Duration duration)
Set a timeout for object.RFuture<Boolean>
expireAsync(Instant instant)
Set an expire date for object.boolean
expireAt(long timestamp)
UseRExpirable.expire(Instant)
insteadboolean
expireAt(Date timestamp)
UseRExpirable.expire(Instant)
insteadRFuture<Boolean>
expireAtAsync(long timestamp)
UseRExpirableAsync.expireAsync(Instant)
insteadRFuture<Boolean>
expireAtAsync(Date timestamp)
UseRExpirableAsync.expireAsync(Instant)
insteadboolean
expireIfGreater(Duration duration)
Sets a timeout for this object only if it's greater than timeout set before.boolean
expireIfGreater(Instant time)
Sets an expiration date for this object only if it's greater than expiration date set before.RFuture<Boolean>
expireIfGreaterAsync(Duration duration)
RFuture<Boolean>
expireIfGreaterAsync(Instant time)
boolean
expireIfLess(Duration duration)
Sets a timeout for this object only if it's less than timeout set before.boolean
expireIfLess(Instant time)
Sets an expiration date for this object only if it's less than expiration date set before.RFuture<Boolean>
expireIfLessAsync(Duration duration)
RFuture<Boolean>
expireIfLessAsync(Instant time)
boolean
expireIfNotSet(Duration duration)
Sets a timeout for this object only if it hasn't been set before.boolean
expireIfNotSet(Instant time)
Sets an expiration date for this object only if it hasn't been set before.RFuture<Boolean>
expireIfNotSetAsync(Duration duration)
RFuture<Boolean>
expireIfNotSetAsync(Instant time)
boolean
expireIfSet(Duration duration)
Sets a timeout for this object only if it has been already set.boolean
expireIfSet(Instant time)
Sets an expiration date for this object only if it has been already set.RFuture<Boolean>
expireIfSetAsync(Duration duration)
RFuture<Boolean>
expireIfSetAsync(Instant time)
long
getExpireTime()
Expiration time of Redisson object that has a timeoutRFuture<Long>
getExpireTimeAsync()
Expiration time of Redisson object that has a timeoutV
getLast()
RFuture<V>
getLastAsync()
Returns element at the tail of this deque ornull
if there are no elements in deque.V
move(DequeMoveArgs args)
Move element from this deque to the given destination deque.RFuture<V>
moveAsync(DequeMoveArgs args)
Move element from this deque to the given destination 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()
List<V>
pollFirst(int limit)
Retrieves and removes the head elements of this queue.RFuture<V>
pollFirstAsync()
Retrieves and removes element at the head of this deque.RFuture<List<V>>
pollFirstAsync(int limit)
Retrieves and removes the head elements of this queue.V
pollLast()
List<V>
pollLast(int limit)
Retrieves and removes the tail elements of this queue.RFuture<V>
pollLastAsync()
Retrieves and removes element at the tail of this deque.RFuture<List<V>>
pollLastAsync(int limit)
Retrieves and removes the tail elements of this queue.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<Boolean>
removeAsync(Object o, int count)
Removes up tocount
occurrences ofelement
RFuture<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.RedissonPriorityQueue
add, addAll, addAsync, binarySearch, clear, clearExpireAsync, comparator, contains, containsAll, deleteAsync, element, expireAsync, expireAtAsync, getFirst, offer, offerAsync, peek, peekAsync, poll, poll, pollAsync, pollAsync, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, remove, removeAll, removeFirst, retainAll, toString, trySetComparator, wrapLockedAsync, wrapLockedAsync
-
Methods inherited from class org.redisson.RedissonList
add, addAfter, addAfterAsync, addAll, addAllAsync, addAllAsync, addAsync, addAsync, addBefore, addBeforeAsync, addListener, addListenerAsync, containsAllAsync, containsAsync, distributedIterator, distributedIterator, equals, fastRemove, fastRemoveAsync, fastSet, fastSetAsync, get, get, getAsync, getAsync, hashCode, indexOf, indexOfAsync, indexOfAsync, isEmpty, iterator, lastIndexOf, lastIndexOfAsync, lastIndexOfAsync, listIterator, listIterator, mapReduce, range, range, rangeAsync, rangeAsync, 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, removeAllAsync, removeAsync, removeAsync, removeIf, removeListener, removeListenerAsync, retainAllAsync, set, setAsync, size, sizeAsync, sortTo, sortTo, sortTo, sortTo, sortTo, sortTo, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, sortToAsync, subList, toArray, toArray, trim, trimAsync
-
Methods inherited from class org.redisson.RedissonObject
addListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getRawName, getRawName, isExists, isExistsAsync, migrate, migrateAsync, move, moveAsync, prefixName, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, 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, expire, expire, expireAt, expireAt, expireIfGreater, expireIfGreater, expireIfLess, expireIfLess, expireIfNotSet, expireIfNotSet, expireIfSet, expireIfSet, getExpireTime, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, expireIfGreaterAsync, expireIfGreaterAsync, expireIfLessAsync, expireIfLessAsync, expireIfNotSetAsync, expireIfNotSetAsync, expireIfSetAsync, expireIfSetAsync, getExpireTimeAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Methods inherited from interface org.redisson.api.RPriorityQueue
comparator, pollLastAndOfferFirstTo, readAll, trySetComparator
-
Methods inherited from interface org.redisson.api.RQueue
addListener, poll
-
Methods inherited from interface org.redisson.api.RQueueAsync
addListenerAsync, offerAsync, peekAsync, pollAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsync
-
-
-
-
Constructor Detail
-
RedissonPriorityDeque
protected RedissonPriorityDeque(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
RedissonPriorityDeque
public RedissonPriorityDeque(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
-
-
Method Detail
-
addFirstIfExists
public int addFirstIfExists(V... elements)
Description copied from interface:RDeque
Adds element at the head of existing deque.- Specified by:
addFirstIfExists
in interfaceRDeque<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the list
-
addLastIfExists
public int addLastIfExists(V... elements)
Description copied from interface:RDeque
Adds element at the tail of existing deque.- Specified by:
addLastIfExists
in interfaceRDeque<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the list
-
addFirst
public int addFirst(V... elements)
Description copied from interface:RDeque
Adds elements at the head of deque.
-
addLast
public int addLast(V... elements)
Description copied from interface:RDeque
Adds elements at the tail of deque.
-
addFirstAsync
public RFuture<Integer> addFirstAsync(V... elements)
Description copied from interface:RDequeAsync
Adds elements at the head of deque.- Specified by:
addFirstAsync
in interfaceRDequeAsync<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the deque
-
addLastAsync
public RFuture<Integer> addLastAsync(V... elements)
Description copied from interface:RDequeAsync
Adds elements at the tail of deque.- Specified by:
addLastAsync
in interfaceRDequeAsync<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the deque
-
addFirstIfExistsAsync
public RFuture<Integer> addFirstIfExistsAsync(V... elements)
Description copied from interface:RDequeAsync
Adds element at the head of existing deque.- Specified by:
addFirstIfExistsAsync
in interfaceRDequeAsync<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the list
-
addLastIfExistsAsync
public RFuture<Integer> addLastIfExistsAsync(V... elements)
Description copied from interface:RDequeAsync
Adds element at the tail of existing deque.- Specified by:
addLastIfExistsAsync
in interfaceRDequeAsync<V>
- Parameters:
elements
- - elements to add- Returns:
- length of the list
-
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
-
removeAsync
public RFuture<Boolean> removeAsync(Object o, int count)
Description copied from interface:RListAsync
Removes up tocount
occurrences ofelement
- Specified by:
removeAsync
in interfaceRListAsync<V>
- Overrides:
removeAsync
in classRedissonList<V>
- Parameters:
o
- - element to findcount
- - amount occurrences- Returns:
true
if at least one element removed; orfalse
if element isn't found
-
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>
-
descendingStream
public Stream<V> descendingStream()
Description copied from interface:RPriorityDeque
Returns stream of elements contained in this deque in reverse order- Specified by:
descendingStream
in interfaceRPriorityDeque<V>
- Returns:
- stream of elements in reverse order
-
pollFirstAsync
public RFuture<List<V>> pollFirstAsync(int limit)
Description copied from interface:RDequeAsync
Retrieves and removes the head elements of this queue. Elements amount limited bylimit
param.- Specified by:
pollFirstAsync
in interfaceRDequeAsync<V>
- Returns:
- list of head elements
-
pollFirst
public List<V> pollFirst(int limit)
Description copied from interface:RDeque
Retrieves and removes the head elements of this queue. Elements amount limited bylimit
param.
-
pollLast
public List<V> pollLast(int limit)
Description copied from interface:RDeque
Retrieves and removes the tail elements of this queue. Elements amount limited bylimit
param.
-
pollLastAsync
public RFuture<List<V>> pollLastAsync(int limit)
Description copied from interface:RDequeAsync
Retrieves and removes the tail elements of this queue. Elements amount limited bylimit
param.- Specified by:
pollLastAsync
in interfaceRDequeAsync<V>
- Returns:
- list of tail elements
-
move
public V move(DequeMoveArgs args)
Description copied from interface:RDeque
Move element from this deque to the given destination deque. Returns moved element.Usage examples:
V element = deque.move(DequeMoveArgs.pollLast() .addFirstTo("deque2"));
V elements = deque.move(DequeMoveArgs.pollFirst() .addLastTo("deque2"));
Requires Redis 6.2.0 and higher.
-
moveAsync
public RFuture<V> moveAsync(DequeMoveArgs args)
Description copied from interface:RDequeAsync
Move element from this deque to the given destination deque. Returns moved element.Usage examples:
V element = deque.move(DequeMoveArgs.pollLast() .addFirstTo("deque2"));
V elements = deque.move(DequeMoveArgs.pollFirst() .addLastTo("deque2"));
Requires Redis 6.2.0 and higher.
- Specified by:
moveAsync
in interfaceRDequeAsync<V>
- Parameters:
args
- - arguments object- Returns:
- moved element
-
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirable
UseRExpirable.expire(Duration)
instead- 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
UseRExpirableAsync.expireAsync(Duration)
instead- 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
UseRExpirable.expire(Instant)
instead- 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
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date in milliseconds (Unix timestamp)- Returns:
true
if the timeout was set andfalse
if not
-
expire
public boolean expire(Instant instant)
Description copied from interface:RExpirable
Sets an expiration date for this object. When expire date comes the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
instant
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
public boolean expireIfSet(Instant time)
Description copied from interface:RExpirable
Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
public RFuture<Boolean> expireIfSetAsync(Instant time)
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
-
expireIfNotSet
public boolean expireIfNotSet(Instant time)
Description copied from interface:RExpirable
Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
public RFuture<Boolean> expireIfNotSetAsync(Instant time)
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
-
expireIfGreater
public boolean expireIfGreater(Instant time)
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
public RFuture<Boolean> expireIfGreaterAsync(Instant time)
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
-
expireIfLess
public boolean expireIfLess(Instant time)
Description copied from interface:RExpirable
Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
time
- expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
public RFuture<Boolean> expireIfLessAsync(Instant time)
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
-
expireAsync
public RFuture<Boolean> expireAsync(Instant instant)
Description copied from interface:RExpirableAsync
Set an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
instant
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expire
public boolean expire(Duration duration)
Description copied from interface:RExpirable
Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expire
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAsync
public RFuture<Boolean> expireAsync(Duration duration)
Description copied from interface:RExpirableAsync
Set a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
expireAsync
in interfaceRExpirableAsync
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirable
UseRExpirable.expire(Instant)
instead- 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
UseRExpirableAsync.expireAsync(Instant)
instead- Specified by:
expireAtAsync
in interfaceRExpirableAsync
- Parameters:
timestamp
- - expire date- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSet
public boolean expireIfSet(Duration duration)
Description copied from interface:RExpirable
Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfSetAsync
public RFuture<Boolean> expireIfSetAsync(Duration duration)
- Specified by:
expireIfSetAsync
in interfaceRExpirableAsync
-
expireIfNotSet
public boolean expireIfNotSet(Duration duration)
Description copied from interface:RExpirable
Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfNotSet
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfNotSetAsync
public RFuture<Boolean> expireIfNotSetAsync(Duration duration)
- Specified by:
expireIfNotSetAsync
in interfaceRExpirableAsync
-
expireIfGreater
public boolean expireIfGreater(Duration duration)
Description copied from interface:RExpirable
Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfGreater
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfGreaterAsync
public RFuture<Boolean> expireIfGreaterAsync(Duration duration)
- Specified by:
expireIfGreaterAsync
in interfaceRExpirableAsync
-
expireIfLess
public boolean expireIfLess(Duration duration)
Description copied from interface:RExpirable
Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.Requires Redis 7.0.0 and higher.
- Specified by:
expireIfLess
in interfaceRExpirable
- Parameters:
duration
- timeout before object will be deleted- Returns:
true
if the timeout was set andfalse
if not
-
expireIfLessAsync
public RFuture<Boolean> expireIfLessAsync(Duration duration)
- Specified by:
expireIfLessAsync
in interfaceRExpirableAsync
-
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
-
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.
-
getExpireTime
public long getExpireTime()
Description copied from interface:RExpirable
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTime
in interfaceRExpirable
- Returns:
- expiration time
-
getExpireTimeAsync
public RFuture<Long> getExpireTimeAsync()
Description copied from interface:RExpirableAsync
Expiration time of Redisson object that has a timeoutRequires Redis 7.0.0 and higher.
- Specified by:
getExpireTimeAsync
in interfaceRExpirableAsync
- Returns:
- expiration time
-
-