-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis coroutine can't to see connections #5106
Comments
reference : https://wiki.swoole.com/#/runtime example: Co::set(['hook_flags' => SWOOLE_HOOK_TCP]);
Co\run(function() {
for ($c = 100; $c--;) {
go(function () {//创建100个协程
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);//此处产生协程调度,cpu切到下一个协程,不会阻塞进程
$redis->get('key');//此处产生协程调度,cpu切到下一个协程,不会阻塞进程
});
}
});
|
Co::set(['hook_flags'=> SWOOLE_HOOK_ALL]); // v4.4+版本使用此方法。
// 或
Swoole\Runtime::enableCoroutine($flags = SWOOLE_HOOK_ALL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I need help
I need to get a count connections.
In this case, there is a subscription record, but there are no connections
php --ri swoole
)?swoole v4.8.13
uname -a
&php -v
&gcc -v
) ?php 7.4
The text was updated successfully, but these errors were encountered: