public static function purge_store($storename, cache_config $config = null) {
        if ($config === null) {
            $config = cache_config::instance();
        }

        $stores = $config->get_all_stores();
        if (!array_key_exists($storename, $stores)) {
            // The store does not exist.
            return false;
        }

        $store = $stores[$storename];
        $class = $store['class'];


        // We check are_requirements_met although we expect is_ready is going to check as well.
        if (!$class::are_requirements_met()) {
            return false;
        }
        // Found the store: is it ready?
        /* @var cache_store $instance */
        $instance = new $class($store['name'], $store['configuration']);
        if (!$instance->is_ready()) {
            unset($instance);
            return false;
        }
        foreach ($config->get_definitions_by_store($storename) as $id => $definition) {
            $definition = cache_definition::load($id, $definition);
            $definitioninstance = clone($instance);
            $definitioninstance->initialise($definition);
            $definitioninstance->purge();
            unset($definitioninstance);
        }

        return true;
    }
public static function purge_store($storename, cache_config $config = null) {
        if ($config === null) {
            $config = cache_config::instance();
        }

        $stores = $config->get_all_stores();
        if (!array_key_exists($storename, $stores)) {
            // The store does not exist.
            return false;
        }

        $store = $stores[$storename];
        $class = $store['class'];


        // We check are_requirements_met although we expect is_ready is going to check as well.
        if (!$class::are_requirements_met()) {
            return false;
        }
        // Found the store: is it ready?
        /* @var cache_store $instance */
        $instance = new $class($store['name'], $store['configuration']);
        if (!$instance->is_ready()) {
            unset($instance);
            return false;
        }
        foreach ($config->get_definitions_by_store($storename) as $id => $definition) {
            $definition = cache_definition::load($id, $definition);
            $definitioninstance = clone($instance);
            $definitioninstance->initialise($definition);
            $definitioninstance->purge();
            unset($definitioninstance);
        }

        return true;
    }
public static function purge_store ( $ storename , cache_config $ config = null ) { if ( $ config === null ) { $ config = cache_config :: instance ( ) ; } $ stores = $ config -> get_all_stores ( ) ; if ( ! array_key_exists ( $ storename , $ stores ) ) { // The store does not exist. return false ; } $ store = $ stores [ $ storename ] ; $ class = $ store [ 'class' ] ; // We check are_requirements_met although we expect is_ready is going to check as well. if ( ! $ class :: are_requirements_met ( ) ) { return false ; } // Found the store: is it ready? /* @var cache_store $instance */ $ instance = new $ class ( $ store [ 'name' ] , $ store [ 'configuration' ] ) ; if ( ! $ instance -> is_ready ( ) ) { unset ( $ instance ) ; return false ; } foreach ( $ config -> get_definitions_by_store ( $ storename ) as $ id => $ definition ) { $ definition = cache_definition :: load ( $ id , $ definition ) ; $ definitioninstance = clone ( $ instance ) ; $ definitioninstance -> initialise ( $ definition ) ; $ definitioninstance -> purge ( ) ; unset ( $ definitioninstance ) ; } return true ; }
Purges a store given its name.

@param string $storename
@param cache_config $config
@return bool
Purges a store given its name .