__construct() 공개 메소드

Construct a new Pool of Workers
public __construct ( integer $size, string | null $class, array | null $ctor = [] )
$size integer The maximum number of Workers this Pool can create
$class string | null The class for new Workers
$ctor array | null An array of arguments to be passed to new Workers
예제 #1
0
 /**
  * @param array                $nodeUrls
  * @param CacheInterface|null  $cache
  * @param LoggerInterface|null $log
  *
  * @throws ConnectException
  */
 public function __construct(array $nodeUrls = array(), CacheInterface $cache = null, LoggerInterface $log = null)
 {
     if (!$cache) {
         $cache = new MemoryCache();
     }
     $this->cache = $cache;
     parent::__construct($nodeUrls, $log);
 }
예제 #2
0
 function __construct($config = array(), $poolSize = 100)
 {
     if (empty($config['host'])) {
         throw new Swoole\Exception\InvalidParam("require redis host option.");
     }
     if (empty($config['port'])) {
         $config = self::DEFAULT_PORT;
     }
     parent::__construct($config, $poolSize);
     $this->create(array($this, 'connect'));
 }
예제 #3
0
 function __construct($config, $maxConnection = 100)
 {
     if (empty($config['host'])) {
         throw new Swoole\Exception\InvalidParam("require mysql host option.");
     }
     if (empty($config['port'])) {
         $config['port'] = self::DEFAULT_PORT;
     }
     parent::__construct($config, $maxConnection);
     $this->create(array($this, 'connect'));
 }
예제 #4
0
 /**
  * Constructor
  * @param array $config Config variables
  * @param boolean $init
  */
 public function __construct($config = [], $init = true)
 {
     parent::__construct($config, false);
     $this->bound = new \PHPDaemon\Structures\ObjectStorage();
     if (isset($this->config->listen)) {
         $this->bindSockets($this->config->listen->value);
     }
     if ($init) {
         $this->init();
     }
 }
예제 #5
0
 public function __construct($size, $class = Worker::class, array $ctor = array())
 {
     $this->pipe = new Pipe();
     $this->packet = new Volatile();
     parent::__construct($size, $class, $ctor);
 }
예제 #6
0
파일: RxPool.php 프로젝트: domraider/rxnet
 public function __construct($size, $class, array $ctor = [])
 {
     parent::__construct($size, $class, $ctor);
 }
 public function __construct(CommandBus $bus)
 {
     parent::__construct(5, CommandBusWorker::class, [$bus]);
 }
예제 #8
0
 /**
  * @param string $path       Cache directory path
  * @param int    $defaultTtl
  */
 public function __construct($path, $defaultTtl = 0)
 {
     parent::__construct($defaultTtl);
     $this->path;
 }
예제 #9
0
 public function __construct($size, $clazz = \Worker::class, $ctor = array())
 {
     $this->resultBag = new \Volatile();
     parent::__construct($size, $clazz, $ctor);
 }
예제 #10
0
 public function __construct($workers = 4, $class = \Worker::class, $ctor = [])
 {
     parent::__construct($workers, $class, $ctor);
 }