yii\mongodb\Cache::gc PHP 메소드

gc() 공개 메소드

Removes the expired data values.
public gc ( boolean $force = false )
$force boolean whether to enforce the garbage collection regardless of [[gcProbability]]. Defaults to false, meaning the actual deletion happens with the probability as specified by [[gcProbability]].
    public function gc($force = false)
    {
        if ($force || mt_rand(0, 1000000) < $this->gcProbability) {
            $this->db->getCollection($this->cacheCollection)->remove(['expire' => ['$gt' => 0, '$lt' => time()]]);
        }
    }