The caching part of the CachingIterator

Code
<?php

$i 
= new ArrayIterator(array(1,7,9));

$ci = new CachingIterator($iCachingIterator::FULL_CACHE);

foreach(
$ci as $value) {
    echo 
$value PHP_EOL;
    
dump($ci->getCache());
}
Result
1
^ array:1 [
0 => 1
]

7
^ array:2 [
0 => 1
1 => 7
]

9
^ array:3 [
0 => 1
1 => 7
2 => 9
]
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8