private function autoPruneExpiredEntries()
    {
        if (0 === $this->options['prune_threshold']) {
            return;
        }

        $item = $this->cache->getItem(self::COUNTER_KEY);
        $counter = (int) $item->get();

        if ($counter > $this->options['prune_threshold']) {
            $this->prune();
            $counter = 0;
        } else {
            ++$counter;
        }

        $item->set($counter);

        $this->cache->saveDeferred($item);
    }
private function autoPruneExpiredEntries()
    {
        if (0 === $this->options['prune_threshold']) {
            return;
        }

        $item = $this->cache->getItem(self::COUNTER_KEY);
        $counter = (int) $item->get();

        if ($counter > $this->options['prune_threshold']) {
            $this->prune();
            $counter = 0;
        } else {
            ++$counter;
        }

        $item->set($counter);

        $this->cache->saveDeferred($item);
    }
private function autoPruneExpiredEntries ( ) { if ( 0 === $ this -> options [ 'prune_threshold' ] ) { return ; } $ item = $ this -> cache -> getItem ( self :: COUNTER_KEY ) ; $ counter = ( int ) $ item -> get ( ) ; if ( $ counter > $ this -> options [ 'prune_threshold' ] ) { $ this -> prune ( ) ; $ counter = 0 ; } else { ++ $ counter ; } $ item -> set ( $ counter ) ; $ this -> cache -> saveDeferred ( $ item ) ; }
Increases a counter every time an item is stored to the cache and then
prunes expired cache entries if a configurable threshold is reached.
This only happens during write operations so cache retrieval is not
slowed down.
Increases a counter every time an item is stored to the cache and then prunes expired cache entries if a configurable threshold is reached . This only happens during write operations so cache retrieval is not slowed down .