M1\Vars\Cache\CacheProvider::load PHP Method

load() public method

Load the cached file into $this->loaded_vars
public load ( )
    public function load()
    {
        $cached_file = sprintf('%s/vars/%s.php', $this->path, $this->name);
        $this->loaded_vars = unserialize(file_get_contents($cached_file));
    }

Usage Example

Beispiel #1
0
 /**
  * Loads the cached file into the current class
  */
 private function loadFromCache()
 {
     $this->cache->load();
     $passed_keys = array('path', 'content', 'extensions', 'loaders', 'resources', 'variables');
     $loaded_vars = get_object_vars($this->cache->getLoadedVars());
     foreach ($loaded_vars as $key => $value) {
         if (in_array($key, $passed_keys)) {
             $this->{$key} = $value;
         }
     }
     $this->cache->setTime($loaded_vars['cache']->getTime());
 }