Pimcore\Cache\Backend\Mongodb::clean PHP Метод

clean() публичный Метод

Available modes are : \Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) \Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) \Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags ($tags can be an array of strings or a single string) \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} ($tags can be an array of strings or a single string) \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags ($tags can be an array of strings or a single string)
public clean ( string $mode = Zend_Cache::CLEANING_MODE_ALL, array $tags = [] ) : boolean
$mode string Clean mode
$tags array Array of tags
Результат boolean True if no problem
    public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = [])
    {
        switch ($mode) {
            case \Zend_Cache::CLEANING_MODE_ALL:
                return $this->_conn->dropDB($this->_options['dbname']);
                break;
            case \Zend_Cache::CLEANING_MODE_OLD:
                return $this->_collection->remove(['expire' => ['$lt' => time()]]);
                break;
            case \Zend_Cache::CLEANING_MODE_MATCHING_TAG:
                return $this->_collection->remove(['t' => ['$all' => $tags]]);
                break;
            case \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
                return $this->_collection->remove(['t' => ['$nin' => $tags]]);
                break;
            case \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
                return $this->_collection->remove(['t' => ['$in' => $tags]]);
                break;
            default:
                \Zend_Cache::throwException('Invalid mode for clean() method');
                break;
        }
    }