src/Psr6/CachePool.php
protected function addElementToBuffer(CacheItem $cacheItem)
    {
        if ($this->bufferSize < 1) {
            return;
        }

        $key = $cacheItem->getKey();
        $this->buffer[$key] = $cacheItem;

        if (in_array($key, $this->bufferKeys)) {
            return;
        }

        array_push($this->bufferKeys, $key);

        if (count($this->bufferKeys) > $this->bufferSize) {
            $element = array_shift($this->bufferKeys);
            unset($this->buffer[$element]);
        }
    }
protected function addElementToBuffer(CacheItem $cacheItem)
    {
        if ($this->bufferSize < 1) {
            return;
        }

        $key = $cacheItem->getKey();
        $this->buffer[$key] = $cacheItem;

        if (in_array($key, $this->bufferKeys)) {
            return;
        }

        array_push($this->bufferKeys, $key);

        if (count($this->bufferKeys) > $this->bufferSize) {
            $element = array_shift($this->bufferKeys);
            unset($this->buffer[$element]);
        }
    }
protected function addElementToBuffer ( CacheItem $ cacheItem ) { if ( $ this -> bufferSize < 1 ) { return ; } $ key = $ cacheItem -> getKey ( ) ; $ this -> buffer [ $ key ] = $ cacheItem ; if ( in_array ( $ key , $ this -> bufferKeys ) ) { return ; } array_push ( $ this -> bufferKeys , $ key ) ; if ( count ( $ this -> bufferKeys ) > $ this -> bufferSize ) { $ element = array_shift ( $ this -> bufferKeys ) ; unset ( $ this -> buffer [ $ element ] ) ; } }
Add an element to buffer. If the buffer is full, the first element added will be removed

@param CacheItem $cacheItem
Add an element to buffer . If the buffer is full the first element added will be removed