Laravel Redis配置 [英] Laravel Redis configuration

查看:235
本文介绍了Laravel Redis配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Laravel和Redis创建一个应用程序.几乎一切正常.我按照文档中的说明扩展了身份验证,用户可以订阅,登录,注销...我可以创建内容,所有内容都存储在Redis中. 但是我有一个问题.我无法运行" php artisan route:list "之类的命令,但出现错误消息:" [InvalidArgumentException]数据库[redis]未配置.".

问题是,在将Redis设置为数据库时,有什么特别的事情可以使Artisan命令正常工作吗? (文档中介绍的基本配置已经完成,几乎所有其他功能都可以正常工作.)

配置: 在config/database.php中,我有:

返回[ ... '默认'=>'redis', ... 'redis'=> [

    'cluster' => false,
    //'connection' => 'default',
    'default' => [
        'host'     => '127.0.0.1',
        'port'     => 6379,
        'database' => 7,
    ],

],

...

PS:尝试访问/password/email(密码重置网址)时,您会遇到相同的错误.

DatabaseManager.php第246行中的

InvalidArgumentException: 未配置数据库[redis].

解决方案

正如 Robert 在评论中所说,之所以会出现此错误,是因为不支持将Redis作为laravel的数据库.

I am currently creating an app with Laravel and Redis. Almost everything is working fine. I extended the Authentication as explained in the documentation, users can subscribe, login, logout ... I can create content and everything is stored in Redis. But I have one issue. I can't run commands like "php artisan route:list", I have an error message : "[InvalidArgumentException] Database [redis] not configured.".

Th question is, is there anything special to do to make Artisan commands work when you set Redis as you database ? (basic configurations explained in the documention have been done and almost everything else is working fine).

Config: In config/database.php I have:

return [ ... 'default' => 'redis', ... 'redis' => [

    'cluster' => false,
    //'connection' => 'default',
    'default' => [
        'host'     => '127.0.0.1',
        'port'     => 6379,
        'database' => 7,
    ],

],

...

PS : You have the same error when you try to access the /password/email (password reset url).

InvalidArgumentException in DatabaseManager.php line 246: Database [redis] not configured.

解决方案

As Robert says in the comments, it looks like there is this error because there is no support for Redis as database for laravel.

这篇关于Laravel Redis配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆