Package org.redisson
Class RedissonRingBuffer<V>
- java.lang.Object
 - 
- org.redisson.RedissonObject
 - 
- org.redisson.RedissonList<V>
 - 
- org.redisson.RedissonQueue<V>
 - 
- org.redisson.RedissonRingBuffer<V>
 
 
 
 
 
- 
- Type Parameters:
 V- value type
- All Implemented Interfaces:
 Iterable<V>,Collection<V>,List<V>,Queue<V>,RandomAccess,RCollectionAsync<V>,RExpirable,RExpirableAsync,RList<V>,RListAsync<V>,RObject,RObjectAsync,RQueue<V>,RQueueAsync<V>,RRingBuffer<V>,RRingBufferAsync<V>,RSortable<List<V>>,RSortableAsync<List<V>>
public class RedissonRingBuffer<V> extends RedissonQueue<V> implements RRingBuffer<V>
- Author:
 - Nikita Koksharov
 
 
- 
- 
Field Summary
- 
Fields inherited from class org.redisson.RedissonObject
codec, commandExecutor, name 
 - 
 
- 
Constructor Summary
Constructors Constructor Description RedissonRingBuffer(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)RedissonRingBuffer(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RFuture<Boolean>addAllAsync(Collection<? extends V> c)Adds all elements contained in the specified collectionRFuture<Boolean>addAsync(V e)Adds element into this collection.intcapacity()Returns capacity of this queueRFuture<Integer>capacityAsync()Returns capacity of this queuebooleanclearExpire()Clear an expire timeout or expire date for object.RFuture<Boolean>clearExpireAsync()Clear an expire timeout or expire date for object in async mode.protected RFuture<Boolean>clearExpireAsync(String... keys)booleanexpire(long timeToLive, TimeUnit timeUnit)Set a timeout for object.booleanexpire(Instant instant)Set an expire date for object.RFuture<Boolean>expireAsync(long timeToLive, TimeUnit timeUnit)Set a timeout for object in async mode.protected RFuture<Boolean>expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)RFuture<Boolean>expireAsync(Instant instant)Set an expire date for object.booleanexpireAt(long timestamp)UseRExpirable.expire(Instant)insteadbooleanexpireAt(Date timestamp)UseRExpirable.expire(Instant)insteadRFuture<Boolean>expireAtAsync(long timestamp)UseRExpirableAsync.expireAsync(Instant)insteadprotected RFuture<Boolean>expireAtAsync(long timestamp, String... keys)RFuture<Boolean>expireAtAsync(Date timestamp)UseRExpirableAsync.expireAsync(Instant)insteadintremainingCapacity()Returns remaining capacity of this queueRFuture<Integer>remainingCapacityAsync()Returns remaining capacity of this queuelongremainTimeToLive()Remaining time to live of Redisson object that has a timeoutRFuture<Long>remainTimeToLiveAsync()Remaining time to live of Redisson object that has a timeoutvoidsetCapacity(int capacity)Sets capacity of the queue and overrides current value.RFuture<Void>setCapacityAsync(int capacity)Sets capacity of the queue and overrides current value.booleantrySetCapacity(int capacity)Sets capacity of the queue only if it wasn't set before.RFuture<Boolean>trySetCapacityAsync(int capacity)Sets capacity of the queue only if it wasn't set before.- 
Methods inherited from class org.redisson.RedissonQueue
element, getFirst, offer, offerAsync, peek, peekAsync, poll, poll, pollAsync, pollAsync, pollLastAndOfferFirstTo, pollLastAndOfferFirstToAsync, remove, removeFirst 
- 
Methods inherited from class org.redisson.RedissonList
add, add, addAfter, addAfterAsync, addAll, addAll, addAllAsync, addAsync, addAsync, addBefore, addBeforeAsync, addListener, addListenerAsync, 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, 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, remove, removeAll, removeAllAsync, removeAsync, removeAsync, removeAsync, removeIf, removeListener, removeListenerAsync, 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
addListener, addListenerAsync, copy, copyAsync, delete, deleteAsync, 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, removeListenersAsync, 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.List
replaceAll, sort, spliterator 
- 
Methods inherited from interface org.redisson.api.RCollectionAsync
containsAllAsync, containsAsync, removeAllAsync, removeAsync, retainAllAsync, sizeAsync 
- 
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive 
- 
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, 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.RQueue
addListener, poll, pollLastAndOfferFirstTo, readAll 
- 
Methods inherited from interface org.redisson.api.RQueueAsync
addListenerAsync, offerAsync, peekAsync, pollAsync, pollAsync, pollLastAndOfferFirstToAsync, readAllAsync 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RedissonRingBuffer
public RedissonRingBuffer(CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
 
- 
RedissonRingBuffer
public RedissonRingBuffer(Codec codec, CommandAsyncExecutor commandExecutor, String name, RedissonClient redisson)
 
 - 
 
- 
Method Detail
- 
trySetCapacityAsync
public RFuture<Boolean> trySetCapacityAsync(int capacity)
Description copied from interface:RRingBufferAsyncSets capacity of the queue only if it wasn't set before.- Specified by:
 trySetCapacityAsyncin interfaceRRingBufferAsync<V>- Parameters:
 capacity- - queue capacity- Returns:
 trueif capacity set successfullyfalseif capacity already set
 
- 
trySetCapacity
public boolean trySetCapacity(int capacity)
Description copied from interface:RRingBufferSets capacity of the queue only if it wasn't set before.- Specified by:
 trySetCapacityin interfaceRRingBuffer<V>- Parameters:
 capacity- - queue capacity- Returns:
 trueif capacity set successfullyfalseif capacity already set
 
- 
setCapacityAsync
public RFuture<Void> setCapacityAsync(int capacity)
Description copied from interface:RRingBufferAsyncSets capacity of the queue and overrides current value. Trims queue if previous capacity value was greater than new.- Specified by:
 setCapacityAsyncin interfaceRRingBufferAsync<V>- Parameters:
 capacity- - queue capacity
 
- 
setCapacity
public void setCapacity(int capacity)
Description copied from interface:RRingBufferSets capacity of the queue and overrides current value. Trims queue if previous capacity value was greater than new.- Specified by:
 setCapacityin interfaceRRingBuffer<V>- Parameters:
 capacity- - queue capacity
 
- 
addAsync
public RFuture<Boolean> addAsync(V e)
Description copied from interface:RCollectionAsyncAdds element into this collection.- Specified by:
 addAsyncin interfaceRCollectionAsync<V>- Overrides:
 addAsyncin classRedissonList<V>- Parameters:
 e- - element to add- Returns:
 trueif an element was added andfalseif it is already present
 
- 
addAllAsync
public RFuture<Boolean> addAllAsync(Collection<? extends V> c)
Description copied from interface:RCollectionAsyncAdds all elements contained in the specified collection- Specified by:
 addAllAsyncin interfaceRCollectionAsync<V>- Overrides:
 addAllAsyncin classRedissonList<V>- Parameters:
 c- - collection of elements to add- Returns:
 trueif at least one element was added andfalseif all elements are already present
 
- 
remainingCapacity
public int remainingCapacity()
Description copied from interface:RRingBufferReturns remaining capacity of this queue- Specified by:
 remainingCapacityin interfaceRRingBuffer<V>- Returns:
 - remaining capacity
 
 
- 
remainingCapacityAsync
public RFuture<Integer> remainingCapacityAsync()
Description copied from interface:RRingBufferAsyncReturns remaining capacity of this queue- Specified by:
 remainingCapacityAsyncin interfaceRRingBufferAsync<V>- Returns:
 - remaining capacity
 
 
- 
capacityAsync
public RFuture<Integer> capacityAsync()
Description copied from interface:RRingBufferAsyncReturns capacity of this queue- Specified by:
 capacityAsyncin interfaceRRingBufferAsync<V>- Returns:
 - queue capacity
 
 
- 
capacity
public int capacity()
Description copied from interface:RRingBufferReturns capacity of this queue- Specified by:
 capacityin interfaceRRingBuffer<V>- Returns:
 - queue capacity
 
 
- 
expire
public boolean expire(long timeToLive, TimeUnit timeUnit)Description copied from interface:RExpirableSet a timeout for object. After the timeout has expired, the key will automatically be deleted.- Specified by:
 expirein interfaceRExpirable- Parameters:
 timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAsync
public RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
Description copied from interface:RExpirableAsyncSet a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.- Specified by:
 expireAsyncin interfaceRExpirableAsync- Parameters:
 timeToLive- - timeout before object will be deletedtimeUnit- - timeout time unit- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAt
public boolean expireAt(long timestamp)
Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
 expireAtin interfaceRExpirable- Parameters:
 timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAtAsync
public RFuture<Boolean> expireAtAsync(long timestamp)
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
 expireAtAsyncin interfaceRExpirableAsync- Parameters:
 timestamp- - expire date in milliseconds (Unix timestamp)- Returns:
 trueif the timeout was set andfalseif not
 
- 
expire
public boolean expire(Instant instant)
Description copied from interface:RExpirableSet an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
 expirein interfaceRExpirable- Parameters:
 instant- - expire date- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAsync
public RFuture<Boolean> expireAsync(Instant instant)
Description copied from interface:RExpirableAsyncSet an expire date for object. When expire date comes the key will automatically be deleted.- Specified by:
 expireAsyncin interfaceRExpirableAsync- Parameters:
 instant- - expire date- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAt
public boolean expireAt(Date timestamp)
Description copied from interface:RExpirableUseRExpirable.expire(Instant)instead- Specified by:
 expireAtin interfaceRExpirable- Parameters:
 timestamp- - expire date- Returns:
 trueif the timeout was set andfalseif not
 
- 
expireAtAsync
public RFuture<Boolean> expireAtAsync(Date timestamp)
Description copied from interface:RExpirableAsyncUseRExpirableAsync.expireAsync(Instant)instead- Specified by:
 expireAtAsyncin interfaceRExpirableAsync- Parameters:
 timestamp- - expire date- Returns:
 trueif the timeout was set andfalseif not
 
- 
clearExpire
public boolean clearExpire()
Description copied from interface:RExpirableClear an expire timeout or expire date for object.- Specified by:
 clearExpirein interfaceRExpirable- Returns:
 trueif timeout was removedfalseif object does not exist or does not have an associated timeout
 
- 
clearExpireAsync
public RFuture<Boolean> clearExpireAsync()
Description copied from interface:RExpirableAsyncClear an expire timeout or expire date for object in async mode. Object will not be deleted.- Specified by:
 clearExpireAsyncin interfaceRExpirableAsync- Returns:
 trueif the timeout was cleared andfalseif not
 
- 
remainTimeToLive
public long remainTimeToLive()
Description copied from interface:RExpirableRemaining time to live of Redisson object that has a timeout- Specified by:
 remainTimeToLivein 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:RExpirableAsyncRemaining time to live of Redisson object that has a timeout- Specified by:
 remainTimeToLiveAsyncin interfaceRExpirableAsync- Returns:
 - time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
 
 
- 
expireAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
 
 - 
 
 -