A circular buffer implementation