Using ring buffer to filter duplicates