A Ringbuffer is a data-structure where the content is stored in a ring like structure.
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.7
Syntax
Type Parameters
- T
The IRingbufferT type exposes the following members.
Methods
Name | Description | |
---|---|---|
![]() | Add | Adds an item to the tail of the Ringbuffer. |
![]() | AddAllAsyncTE | Adds all the items of a collection to the tail of the Ringbuffer. |
![]() | AddAsync |
Asynchronously writes an item with a configurable
OverflowPolicy
.
If there is space in the ringbuffer, the call will return the sequence of the written item.
If there is no space, it depends on the overflow policy what happens:
int sleepMs = 100; for (; ; ) { long result = ringbuffer.AddAsync(item, OverflowPolicy.Fail).Result; if (result != -1) { break; } Thread.Sleep(sleepMs); sleepMs = Math.Min(5000, sleepMs * 2); } |
![]() | Capacity | Returns the capacity of this Ringbuffer. |
![]() | Destroy | Destroys this object cluster-wide. (Inherited from IDistributedObject.) |
![]() | GetName | Returns the unique name for this IDistributedObject. (Inherited from IDistributedObject.) |
![]() | GetPartitionKey | Returns the key of partition this IDistributedObject is assigned to. (Inherited from IDistributedObject.) |
![]() | GetServiceName | Returns the service name for this object. (Inherited from IDistributedObject.) |
![]() | HeadSequence | Returns the sequence of the head. |
![]() | ReadManyAsync | Reads a batch of items from the Ringbuffer. |
![]() | ReadOne | Reads one item from the Ringbuffer. |
![]() | RemainingCapacity | Returns the remaining capacity of the ringbuffer. |
![]() | Size | Returns number of items in the ringbuffer. |
![]() | TailSequence | Returns the sequence of the tail. |
Remarks
- tailSequence: this is the side where the youngest item is found. So the tail is the side of the ringbuffer where items are added to.
- headSequence: this is the side where the oldest items are found. So the head is the side where items gets discarded.
See Also