CacheTool\CacheTool::setAdapter PHP Method

setAdapter() public method

public setAdapter ( AbstractAdapter $adapter ) : CacheTool
$adapter CacheTool\Adapter\AbstractAdapter
return CacheTool
    public function setAdapter(AbstractAdapter $adapter)
    {
        $this->logger->info(sprintf('Setting adapter: %s', get_class($adapter)));
        $this->adapter = $adapter;
        $this->adapter->setLogger($this->logger);
        $this->adapter->setTempDir($this->tempDir);
        return $this;
    }

Usage Example

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     opcache_reset();
     $adapter = new FastCGI('/dev/shm/php-cgi.sock');
     $cache = new CacheTool();
     $cache->setAdapter($adapter);
     $cache->addProxy(new Proxy\OpcacheProxy());
     $cache->addProxy(new Proxy\PhpProxy());
     $cache->opcache_reset();
     echo 'a';
 }
All Usage Examples Of CacheTool\CacheTool::setAdapter