本文整理汇总了PHP中Pool::hmset方法的典型用法代码示例。如果您正苦于以下问题:PHP Pool::hmset方法的具体用法?PHP Pool::hmset怎么用?PHP Pool::hmset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pool
的用法示例。
在下文中一共展示了Pool::hmset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onReady
/**
* Called when the worker is ready to go
* @return void
*/
public function onReady()
{
$this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance();
$this->redis->hmset('myset', 'field1', 'value1', 'field2', 'value2', 'field3', 'value3', 'field4', 'value4', 'field5', 'value5', function ($redis) {
$this->redis->hgetall('myset', function ($redis) {
D('TEST 1: HGETALL');
foreach ($redis as $key => $value) {
D($key . ' - ' . $value);
}
D($redis->assoc);
});
$this->redis->hmget('myset', 'field2', 'field4', function ($redis) {
D('TEST 2: HMGET');
foreach ($redis as $key => $value) {
D($key . ' - ' . $value);
}
D($redis->assoc);
});
});
$this->redis->zadd('myzset', 100, 'one', 150, 'two', 325, 'three', function ($redis) {
$this->redis->zrange('myzset', 0, -1, function ($redis) {
D('TEST 3: ZRANGE');
foreach ($redis as $key => $value) {
D($key . ' - ' . $value);
}
D($redis->assoc);
});
$this->redis->zrange('myzset', 0, -1, 'WITHSCORES', function ($redis) {
D('TEST 4: ZRANGE WITHSCORES');
foreach ($redis as $key => $value) {
D($key . ' - ' . $value);
}
D($redis->assoc);
});
});
$this->redis->subscribe('mysub', function ($redis) {
D('TEST 5: SUB & PUB');
foreach ($redis as $key => $value) {
D($key . ' - ' . $value);
}
D($redis->channel, $redis->msg, $redis->assoc);
});
$this->redis->publish('mysub', 'Test message!');
}