2017 © Pedro Peláez
 

library queue

数据列队

image

hutong/queue

数据列队

  • Friday, July 21, 2017
  • by HuTong
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

queue

数据列队, (*1)

配置

1、php数组存储
$config = array(
    'type' => 'Arr',
    'host' => '0.0.0.0',
    'port' => '9510',
    'server' => array(
        'worker_num' => 1,
    )
);
2、redis存储
$config = array(
    'type' => 'Redis',
    'host' => '0.0.0.0',
    'port' => '9510',
    'server' => array(
        'worker_num' => 1,
    ),
    'set' => array(
        'host' => '127.0.0.1',
        'port' => '6379',
        'password' => '123456',
        'listName' => 'queueList',
    ),
);
3、SplQueue存储
$config = array(
    'type' => 'Spl',
    'host' => '0.0.0.0',
    'port' => '9510',
    'server' => array(
        'worker_num' => 1,
    )
);

服务端

include './vendor/autoload.php';

$serv = new HuTong\Queue\Server($config);
$serv->listen();

客户端

$config = array(
    'ip' => '127.0.0.1',
    'port' => '9510',
    'timeout' => 2
);
include './vendor/autoload.php';

$client = new HuTong\Queue\Client($config);

for ($i = 0; $i < 100; $i++)
{
    $info = $client->push('N:'.$i);
    var_dump($info);
}

$info = $client->pop();
var_dump($info);

学习交流群

630730920, (*2)

The Versions

21/07 2017

dev-master

9999999-dev

数据列队

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar HuTong