Nette\Loaders\RobotLoader::setCacheStorage PHP Method

setCacheStorage() public method

Deprecation:
public setCacheStorage ( Nette\Caching\IStorage $storage )
$storage Nette\Caching\IStorage
    public function setCacheStorage(Nette\Caching\IStorage $storage)
    {
        if ($storage instanceof Nette\Caching\Storages\FileStorage) {
            // back compatibility
            $prop = (new \ReflectionClass($storage))->getProperty('dir');
            $prop->setAccessible(TRUE);
            $this->tempDirectory = $prop->getValue($storage) . '/Nette.RobotLoader';
        } elseif ($storage instanceof Nette\Caching\Storages\DevNullStorage) {
            $this->tempDirectory = NULL;
        } else {
            trigger_error(__METHOD__ . '() is deprecated; use setTempDirectory() to enable caching again.', E_USER_WARNING);
        }
        return $this;
    }

Usage Example

 /**
  * Creates the configurator instance and prepares configuration cache.
  */
 public function __construct(array $arguments)
 {
     parent::__construct();
     $this->cache = new MemoryStorage();
     $this->loader = new RobotLoader();
     $this->loader->setCacheStorage($this->cache);
     $this->loader->autoRebuild = false;
     $this->arguments = $arguments;
 }
All Usage Examples Of Nette\Loaders\RobotLoader::setCacheStorage