Package org.redisson.api
Interface RRingBuffer<V>
-
- Type Parameters:
V
- value type
- All Superinterfaces:
Collection<V>
,Iterable<V>
,Queue<V>
,RCollectionAsync<V>
,RExpirable
,RExpirableAsync
,RObject
,RObjectAsync
,RQueue<V>
,RQueueAsync<V>
,RRingBufferAsync<V>
- All Known Implementing Classes:
RedissonRingBuffer
public interface RRingBuffer<V> extends RQueue<V>, RRingBufferAsync<V>
RingBuffer based queue evicts elements from the head if queue capacity became full.The head element removed if new element added and queue is full.
Must be initialized with capacity size
trySetCapacity(int)
before usage.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
capacity()
Returns capacity of this queueint
remainingCapacity()
Returns remaining capacity of this queuevoid
setCapacity(int capacity)
Sets capacity of the queue and overrides current value.boolean
trySetCapacity(int capacity)
Sets capacity of the queue only if it wasn't set before.-
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
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, 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
-
Methods inherited from interface org.redisson.api.RRingBufferAsync
capacityAsync, remainingCapacityAsync, setCapacityAsync, trySetCapacityAsync
-
-
-
-
Method Detail
-
trySetCapacity
boolean trySetCapacity(int capacity)
Sets capacity of the queue only if it wasn't set before.- Parameters:
capacity
- - queue capacity- Returns:
true
if capacity set successfullyfalse
if capacity already set
-
setCapacity
void setCapacity(int capacity)
Sets capacity of the queue and overrides current value. Trims queue if previous capacity value was greater than new.- Parameters:
capacity
- - queue capacity
-
remainingCapacity
int remainingCapacity()
Returns remaining capacity of this queue- Returns:
- remaining capacity
-
capacity
int capacity()
Returns capacity of this queue- Returns:
- queue capacity
-
-