On this page
Class BufferedIterator
Creates an iterator from another iterator that will keep the results of the inner iterator in memory, so that results don't have to be re-calculated.
- IteratorIterator implements Iterator, Traversable, OuterIterator
 
 Cake\Collection\Collection implements Cake\Collection\CollectionInterface, Serializable uses Cake\Collection\CollectionTrait
   
 Cake\Collection\Iterator\BufferedIterator implements Countable, Serializable
   
Properties summary
- 
    
$_bufferprotectedThe in-memory cache containing results from previous iteratorsSplDoublyLinkedList - 
    
$_currentprotectedLast record fetched from the inner iteratormixed - 
    
$_finishedprotectedWhether or not the internal iterator has reached its end.boolean - 
    
$_indexprotectedPoints to the next record number that should be fetchedinteger - 
    
$_keyprotectedLast key obtained from the inner iteratormixed - 
    
$_startedprotectedbooleanWhether or not the internal iterator's rewind method was already called
 
Method Summary
- 
    __construct() public
Maintains an in-memory cache of the results yielded by the internal iterator.
 - 
    count() publicReturns the number or items in this collection
 - 
    current() publicReturns the current record in the iterator
 - 
    key() publicReturns the current key in the iterator
 - 
    next() publicAdvances the iterator pointer to the next element
 - 
    rewind() publicRewinds the collection
 - 
    serialize() public
Returns a string representation of this object that can be used to reconstruct it
 - 
    unserialize() publicUnserializes the passed string and rebuilds the BufferedIterator instance
 - 
    valid() publicReturns whether or not the iterator has more elements
 
Method Detail
__construct()source public
__construct( array|Traversable $items )
   Maintains an in-memory cache of the results yielded by the internal iterator.
Parameters
- 
     array|Traversable 
$items - The items to be filtered.
 
Throws
InvalidArgumentExceptionIf passed incorrect type for items.
Overrides
Cake\Collection\Collection::__construct()
  count()source public
count( )
   Returns the number or items in this collection
Returns
integerThrows
LogicExceptionOverrides
Cake\Collection\Collection::count()
   Implementation of
Countable::count()
  current()source public
current( )
   Returns the current record in the iterator
Returns
mixedOverrides
IteratorIterator::current()
  key()source public
key( )
   Returns the current key in the iterator
Returns
mixedOverrides
IteratorIterator::key()
  next()source public
next( )
   Advances the iterator pointer to the next element
Overrides
IteratorIterator::next()
  serialize()source public
serialize( )
   Returns a string representation of this object that can be used to reconstruct it
Returns
stringOverrides
Cake\Collection\Collection::serialize()
   Implementation of
Serializable::serialize()
  unserialize()source public
unserialize( string $buffer )
   Unserializes the passed string and rebuilds the BufferedIterator instance
Parameters
- 
     string 
$buffer - The serialized buffer iterator
 
Overrides
Cake\Collection\Collection::unserialize()
   Implementation of
Serializable::unserialize()
  valid()source public
valid( )
   Returns whether or not the iterator has more elements
Returns
booleanOverrides
IteratorIterator::valid()
  Methods inherited from Cake\Collection\Collection
__debugInfo()source public
__debugInfo( )
   Returns an array that can be used to describe the internal state of this object.
Returns
arrayMethods used from Cake\Collection\CollectionTrait
_unwrap()source public
_unwrap( )
   Backwards compatible wrapper for unwrap()
Deprecated
Returns
Iteratorappend()source public
append( $items )
  cartesianProduct()source public
cartesianProduct( callable $operation null , callable $filter null )
   Returns
Cake\Collection\CollectionInterfacechunk()source public
chunk( $chunkSize )
  combine()source public
combine( $keyPath , $valuePath , $groupPath null )
  compile()source public
compile( $preserveKeys true )
  contains()source public
contains( $value )
  countBy()source public
countBy( $callback )
  each()source public
each( callable $c )
  every()source public
every( callable $c )
  extract()source public
extract( $matcher )
  first()source public
first( )
  firstMatch()source public
firstMatch( array $conditions )
  groupBy()source public
groupBy( $callback )
  indexBy()source public
indexBy( $callback )
  isEmpty()source public
isEmpty( )
  jsonSerialize()source public
jsonSerialize( )
  last()source public
last( )
  listNested()source public
listNested( $dir 'desc' , $nestingKey 'children' )
   Returns
Cake\Collection\Iterator\TreeIteratormatch()source public
match( array $conditions )
  max()source public
max( $callback , $type SORT_NUMERIC )
  min()source public
min( $callback , $type SORT_NUMERIC )
  nest()source public
nest( $idPath , $parentPath , $nestingKey 'children' )
  reduce()source public
reduce( callable $c , $zero null )
  sample()source public
sample( $size 10 )
  shuffle()source public
shuffle( )
  skip()source public
skip( $howMany )
  some()source public
some( callable $c )
  sortBy()source public
sortBy( $callback , $dir SORT_DESC , $type SORT_NUMERIC )
  sumOf()source public
sumOf( $matcher null )
  take()source public
take( $size 1 , $from 0 )
  through()source public
through( callable $handler )
  toArray()source public
toArray( $preserveKeys true )
  toList()source public
toList( )
  unfold()source public
unfold( callable $transformer null )
  unwrap()source public
unwrap( )
  zip()source public
zip( $items )
  zipWith()source public
zipWith( $items , $callable )
  Properties detail
$_buffersource
protected SplDoublyLinkedList
The in-memory cache containing results from previous iterators
$_startedsource
protected boolean
Whether or not the internal iterator's rewind method was already called
false
   © 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
 https://api.cakephp.org/3.3/class-Cake.Collection.Iterator.BufferedIterator.html