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]);
        }
    }