antyblin / laravel-swoole-redis
Laravel 扩展包,提供 Swoole Redis 连接池集成、Laravel Redis 连接池缓存和会话驱动程序。
1.1
2023-05-03 22:16 UTC
Requires
- php: >=7.4
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- laravel/framework: ^10.0
- swoole/ide-helper: @dev
This package is auto-updated.
Last update: 2024-09-04 01:12:15 UTC
README
默认的 Laravel Redis 连接在 Swoole 协程中运行时可能会引发错误。
此包增加了 Swoole RedisPool 作为 Laravel 的缓存和会话驱动程序的支持。
这是 falcolee/laravel-swoole-redis
包的分支,原始想法来自 https://github.com/falcolee。
安装
步骤 1
安装包
composer require antyblin/laravel-swoole-redis
步骤 2
将 redis_pool
存储添加到 config/cache.php
中的 stores
部分
'redis_pool' => [ 'driver' => 'redis', 'connection' => 'default', ],
步骤 3
在您的 .env
文件中将您的 Redis 驱动程序或会话驱动程序更改为 redis_pool
,然后完成。
配置
您可以在 config/database.php
中的 Redis 部分添加额外的参数 'pool_size'
。此参数设置 RedisPool 中的最大连接数。
'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT'), 'database' => env('REDIS_CACHE_DB'), 'pool_size' => env('REDIS_POOL_SIZE', 64) ],