用composer引入predis包
composer require predis/predis
配置缓存驱动
在.env文件中把CACHE_DRIVER设置为redis
配置redis参数
//在config/cache.php中配置redis
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
//connection为laravel的redis预选方案,在config/database.php中可以修改
],