echo __METHOD__ . "()\n";
        var_dump($this->getCache());
    }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo' => 1, 2, 'bar' => 3, 4)));
try {
    var_dump($it->offsetSet(0, 0));
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
try {
    var_dump($it->offsetUnset(0));
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE);
var_dump($it->offsetSet());
var_dump($it->offsetSet(0));
var_dump($it->offsetUnset());
$checks = array(0 => 25, 1 => 42, 3 => 'FooBar');
$unsets = array(0, 2);
$it->testSet($checks);
$it->show();
$it->testUnset($unsets);
$it->show();
$it->fill();
$it->show();
$it->testSet($checks);
$it->show();
$it->testUnset($unsets);
$it->show();
            echo "==={$k}===\n";
            var_dump($v);
            var_dump($this->offsetExists($v));
            var_dump($this->offsetGet($v));
        }
    }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo' => 1, 2, 'bar' => 3, 4)));
try {
    var_dump($it->offsetExists(0));
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
try {
    var_dump($it->offsetGet(0));
} catch (Exception $e) {
    echo "Exception: " . $e->getMessage() . "\n";
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo' => 1, 2, 'bar' => 3, 4)), CachingIterator::FULL_CACHE);
var_dump($it->offsetExists());
var_dump($it->offsetGet());
$checks = array(0, new stdClass(), new MyFoo(), NULL, 2, 'foo', 3);
$it->test($checks);
echo "===FILL===\n";
foreach ($it as $v) {
}
// read all into cache
$it->test($checks);
?>
===DONE===
    function __toString()
    {
        return 'foo';
    }
}
class MyCachingIterator extends CachingIterator
{
    function __construct(Iterator $it, $flags = 0)
    {
        parent::__construct($it, $flags);
    }
    function fill()
    {
        echo __METHOD__ . "()\n";
        foreach ($this as $v) {
        }
    }
    function show()
    {
        echo __METHOD__ . "()\n";
        foreach ($this as $v) {
            var_dump((string) $this);
        }
    }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo' => 1, 'bar' => 2)), CachingIterator::TOSTRING_USE_KEY);
$it->fill();
$it->show();
?>
===DONE===