SlidingBuffer

cispy/buffers~ SlidingBuffer

Source:

A buffer implementation that drops the oldest item when an item is added to a full buffer.

This is very similar to DroppingBuffer; the only difference is in what happens when an item is added. In this buffer, the new item is indeed added to the buffer, but in order to keep the count of the buffer at or below its size, the oldest item in the buffer is silently dropped.

Extends

Members

(readonly) full :number

Source:

Whether or not the buffer is full. As a SlidingBuffer is never considered full, this will always return false.

Type:
  • number

Methods

add(…items)

Source:

Adds one or more items to the buffer. If the buffer has already reached its capacity, then the oldest items in the buffer are dropped to make way for the new items.

Parameters:
Name Type Attributes Description
items * <repeatable>

The items to be added to the buffer.