protected function setRedisConfig()
 {
     $default = $this->app['config']['resque.default'];
     $config = $this->app['config'][sprintf('database.redis.%s', $default)];
     if (!$config) {
         $config = $this->app['config']['database.redis.default'];
     }
     $host = isset($config['host']) ? $config['host'] : 'localhost';
     $port = isset($config['port']) ? $config['port'] : 6379;
     $database = isset($config['database']) ? $config['database'] : 0;
     $password = isset($config['password']) ? $config['password'] : '';
     $server = implode(':', [$host, $port]);
     if ($password) {
         $server = implode('@', [implode(':', ['', $password]), $server]);
     }
     $dsn = sprintf('redis://%s/%s', $server, $database);
     \Resque::setBackend($dsn);
 }
Exemple #2
0
 /**
  * @return int
  *
  * @throws RuntimeException
  */
 public function fork()
 {
     return \Resque::fork();
 }