protected function reduce_for_maxsize() {
        $diff = $this->storecount - $this->maxsize;
        if ($diff < 1) {
            return 0;
        }
        // Reduce it by an extra 10% to avoid calling this repetitively if we are in a loop.
        $diff += floor($this->maxsize / 10);
        $this->store = array_slice($this->store, $diff, null, true);
        $this->storecount -= $diff;
        return $diff;
    }