添加 redis

This commit is contained in:
hant 2025-02-26 17:59:47 +08:00
parent ff493aeee3
commit f515ea4869

View File

@ -187,13 +187,24 @@ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
'cache' => [ 'cache' => [
// 驱动方式 // 驱动方式
'type' => 'File', // 'type' => 'file',
// 缓存保存目录 // 缓存保存目录
'path' => CACHE_PATH, 'path' => CACHE_PATH,
// 缓存前缀 // 缓存前缀
'prefix' => '', 'prefix' => '',
// 缓存有效期 0表示永久缓存 // 缓存有效期 0表示永久缓存
'expire' => 0, 'expire' => 0,
'type' => 'redis',
// 'redis' => [
'host' => Env::get('redis.redis_host'), // Redis 服务器地址
'port' => Env::get('redis.redis_port'), // Redis 端口
'password' => Env::get('redis.redis_password'), // Redis 密码,如果有的话
'select' => Env::get('redis.redis_db'), // 默认数据库0-15
'timeout' => 0, // Redis 连接超时
// 'prefix' => '', // 缓存前缀
// 'expire' => 3600, // 默认缓存过期时间(秒)
// ],
], ],
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 会话设置 // | 会话设置
@ -205,10 +216,20 @@ return [
// SESSION 前缀 // SESSION 前缀
'prefix' => 'think', 'prefix' => 'think',
// 驱动方式 支持redis memcache memcached // 驱动方式 支持redis memcache memcached
'type' => '', // 'type' => 'redis',
// 是否自动开启 SESSION // 是否自动开启 SESSION
'auto_start' => true, 'auto_start' => true,
//'cache_limiter'=>''
'type' => 'redis',
// 'redis' => [
'host' => Env::get('redis.redis_host'), // Redis 服务器地址
'port' => Env::get('redis.redis_port'), // Redis 端口
'password' => Env::get('redis.redis_password'), // Redis 密码,如果有的话
'select' => Env::get('redis.redis_db'),
'timeout' => 0, // Redis 连接超时
'expire' => 3600, // 默认缓存过期时间(秒)
// ],
], ],
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Cookie设置 // | Cookie设置