/**
  * 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';
 }
Ejemplo n.º 2
0
 /**
  * @param  InputInterface     $input
  * @return ContainerInterface
  */
 public function buildContainer(InputInterface $input)
 {
     if ($input->hasParameterOption('--cli')) {
         $this->config['adapter'] = 'cli';
     } else {
         if ($input->hasParameterOption('--fcgi')) {
             $this->config['adapter'] = 'fastcgi';
             $this->config['fastcgi'] = $input->getParameterOption('--fcgi');
         }
     }
     if ($input->hasParameterOption('--tmp-dir') || $input->hasParameterOption('-t')) {
         $this->config['temp_dir'] = $input->getParameterOption('--tmp-dir') ?: $input->getParameterOption('-t');
     }
     switch ($this->config['adapter']) {
         case 'cli':
             $adapter = new Cli();
             break;
         case 'fastcgi':
             $adapter = new FastCGI($this->config['fastcgi']);
             break;
         default:
             throw new \RuntimeException("Adapter `{$this->config['adapter']}` is not one of cli or fastcgi");
     }
     $cacheTool = CacheTool::factory($adapter, $this->config['temp_dir'], $this->logger);
     $container = new Container();
     $container->set('cachetool', $cacheTool);
     $container->set('logger', $this->logger);
     return $container;
 }
Ejemplo n.º 3
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testInexistentWithMagicCallFunction()
 {
     $cachetool = new CacheTool(null, $this->getLogger());
     $cachetool->__call('doesNotExist', array());
 }