array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'cachingiterator.getcache.php', 1 => 'CachingIterator::getCache', ), 'up' => array ( 0 => 'class.cachingiterator.php', 1 => 'CachingIterator', ), 'prev' => array ( 0 => 'cachingiterator.current.php', 1 => 'CachingIterator::current', ), 'next' => array ( 0 => 'cachingiterator.getflags.php', 1 => 'CachingIterator::getFlags', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/spl/cachingiterator/getcache.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::getCache — キャッシュの内容を取得する
この関数にはパラメータはありません。
キャッシュの内容を含む配列を返します。
CachingIterator::FULL_CACHE
フラグを使っていない場合に
BadMethodCallException をスローします。
例1 CachingIterator::getCache() の例
<?php
$iterator = new ArrayIterator(array(1, 2, 3));
$cache = new CachingIterator($iterator, CachingIterator::FULL_CACHE);
$cache->next();
$cache->next();
var_dump($cache->getCache());
$cache->next();
var_dump($cache->getCache());
?>
上の例の出力は以下となります。
array(2) { [0]=> int(1) [1]=> int(2) } array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }