Is there an existing data structure that is of fixed size, and will push the oldest/last element out if a new element is inserted?
Fixed-size queues are often implemented using what some people call circular buffers. If you remove the protection against it being full, you get the desired behaviour.

Of course, no actual pushing will happen in the array -- that would be too expensive -- but it will look like it from the outside.