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:
- Overwrite : we just overwrite the oldest item in the ringbuffer and we violate the ttl
- Fail : we return -1
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); }
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.7.1
Syntax
Parameters
- item
- Type: T
the item to add - overflowPolicy
- Type: Hazelcast.CoreOverflowPolicy
the OverflowPolicy to use.
Return Value
Type: TaskInt64the sequenceId of the added item, or -1 if the add failed.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | if item or overflowPolicy is null. |
See Also