Package org.redisson.api
Interface RRingBufferRx<V>
-
- Type Parameters:
V
- value type
- All Superinterfaces:
RCollectionRx<V>
,RExpirableRx
,RObjectRx
,RQueueRx<V>
public interface RRingBufferRx<V> extends RQueueRx<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 io.reactivex.rxjava3.core.Single<Integer>
capacity()
Returns capacity of this queueio.reactivex.rxjava3.core.Single<Integer>
remainingCapacity()
Returns remaining capacity of this queueio.reactivex.rxjava3.core.Completable
setCapacity(int capacity)
Sets capacity of the queue and overrides current value.io.reactivex.rxjava3.core.Single<Boolean>
trySetCapacity(int capacity)
Sets queue capacity only if it is not set before.-
Methods inherited from interface org.redisson.api.RCollectionRx
add, addAll, addAll, contains, containsAll, iterator, remove, removeAll, retainAll, size
-
Methods inherited from interface org.redisson.api.RExpirableRx
clearExpire, expire, expireAt, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RObjectRx
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
-
-
-
Method Detail
-
trySetCapacity
io.reactivex.rxjava3.core.Single<Boolean> trySetCapacity(int capacity)
Sets queue capacity only if it is not set before.- Parameters:
capacity
- - queue capacity- Returns:
true
if capacity set successfullyfalse
if capacity already set
-
setCapacity
io.reactivex.rxjava3.core.Completable 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
io.reactivex.rxjava3.core.Single<Integer> remainingCapacity()
Returns remaining capacity of this queue- Returns:
- remaining capacity
-
capacity
io.reactivex.rxjava3.core.Single<Integer> capacity()
Returns capacity of this queue- Returns:
- queue capacity
-
-