__construct() public method

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
ファイル: CachingPool.php プロジェクト: 0x20h/phloppy
 /**
  * @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
ファイル: Redis.php プロジェクト: matyhtf/swoole_framework
 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
ファイル: MySQL.php プロジェクト: matyhtf/swoole_framework
 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
ファイル: Server.php プロジェクト: kakserpom/phpdaemon
 /**
  * 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
ファイル: Pool.php プロジェクト: JesusTheHun/GreenMT
 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);
 }
コード例 #7
0
 public function __construct(CommandBus $bus)
 {
     parent::__construct(5, CommandBusWorker::class, [$bus]);
 }
コード例 #8
0
ファイル: FilePool.php プロジェクト: elegantweb/framework
 /**
  * @param string $path       Cache directory path
  * @param int    $defaultTtl
  */
 public function __construct($path, $defaultTtl = 0)
 {
     parent::__construct($defaultTtl);
     $this->path;
 }
コード例 #9
0
ファイル: Pool.php プロジェクト: JesusTheHun/GreenMT
 public function __construct($size, $clazz = \Worker::class, $ctor = array())
 {
     $this->resultBag = new \Volatile();
     parent::__construct($size, $clazz, $ctor);
 }
コード例 #10
0
ファイル: PromiseManager.php プロジェクト: krakjoe/promises
 public function __construct($workers = 4, $class = \Worker::class, $ctor = [])
 {
     parent::__construct($workers, $class, $ctor);
 }