Skip to content
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

swoft redis组件不支持select命令 #1312

Closed
studyzhanglei opened this issue Jun 11, 2020 · 6 comments
Closed

swoft redis组件不支持select命令 #1312

studyzhanglei opened this issue Jun 11, 2020 · 6 comments
Assignees
Labels
optimization swoft: db Issues for swoft db component
Milestone

Comments

@studyzhanglei
Copy link

看了一下源码,在vendor/swoft/redis/src/Connection/Connection.php 的$supportedMethods数组变量里面加上select命令就好了,官方能否加一下呢?

之前老业务一个redis实例里面用了很多的db,如果不支持select命令的话,需要写非常多的redis配置

@github-actions github-actions bot added the swoft: db Issues for swoft db component label Jun 11, 2020
@inhere inhere added this to the v2.0.10 milestone Jun 11, 2020
@sakuraovq
Copy link
Member

redis->call( function( $redis) { $redis->select() });

@sakuraovq
Copy link
Member

@studyzhanglei 先用下这样的呢

@studyzhanglei
Copy link
Author

redis->call( function( $redis) { $redis->select() });

好的,多谢~

@studyzhanglei
Copy link
Author

@studyzhanglei 先用下这样的呢

这样不行,只有在匿名函数内redis db才会变化,比如在匿名函数内部使用了select(10),外部还是默认的db

@sakuraovq
Copy link
Member

@studyzhanglei redis 每次执行都会 从连接池获取连接 select 需要保证在同一连接

用完了需要自己重置才行喔

@sakuraovq
Copy link
Member

每次 redis 操作可能用的不是一个连接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization swoft: db Issues for swoft db component
Projects
None yet
Development

No branches or pull requests

4 participants