本文整理匯總了PHP中Pool::hmget方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pool::hmget方法的具體用法?PHP Pool::hmget怎麽用?PHP Pool::hmget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pool
的用法示例。
在下文中一共展示了Pool::hmget方法的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!');
}