CacheTool\CacheTool::addProxy PHP Method

addProxy() public method

public addProxy ( CacheTool\Proxy\ProxyInterface $proxy ) : CacheTool
$proxy CacheTool\Proxy\ProxyInterface
return CacheTool
    public function addProxy(ProxyInterface $proxy)
    {
        $this->logger->info(sprintf('Adding Proxy: %s', get_class($proxy)));
        $this->proxies[] = $proxy;
        // reset functions (to be built when needed)
        $this->functions = array();
        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';
 }