laravel 框架,redis的anth连接应该是怎么样的、。

laravel 框架,redis的anth连接应该是怎么样的、。

阅读 2.5k
2 个回答

官方文档里说了啊。你不看文档啊?

The Redis configuration for your application is located in the config/database.php configuration file. Within this file, you will see a redis array containing the Redis servers utilized by your application:

'redis' => [

    'client' => 'predis',

    'cluster' => false,

    'default' => [
        'host' => env('REDIS_HOST', 'localhost'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],

],

https://laravel.com/docs/5.3/...

楼主是无法配置redis到cache默认缓存吗?

1.改配置文件

'redis' => [
    'client' => 'predis',
    'cluster' => false,
    'default' => [
        'host' => env('REDIS_HOST', 'localhost'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],
],

2.还要在.env文件中加入

CACHE_DRIVER=redis
SESSION_DRIVER=redis
QUEUE_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=your password
REDIS_PORT=6379

laravel缓存详细介绍(中文)
https://laravel-china.org/doc...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题