Implement a ringbuffer