-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
1.redis配置:
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'auth' => env('REDIS_AUTH', ''),
'port' => (int) env('REDIS_PORT', 6379),
'db' => (int) env('REDIS_DB', 0), // 这里选择的数据库索引我配置的是1
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
],
],2.由于在程序中,我们的数据分布在好几个不同的db索引,这个时候需要跨redis数据库的索引查询,
...
$this->client_redis=$this->container->get(\Redis::class) ;
.....
$this->client_redis->select(7); //
$this->client_redis->get('key') // 这个时候查询的数据并不是索引为7的值,仍然是索引为初始化配置时设置的索引 1 所在的数据库值。Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested