Files
dafuweng-saiadmin6.x/server/config/think-cache.php
2026-03-05 17:20:44 +08:00

44 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
return [
// 默认缓存驱动API 用户缓存依赖 Redis建议设为 redis 并配置 REDIS_*
'default' => env('CACHE_MODE', 'redis'),
// 缓存连接方式配置
'stores' => [
// redis缓存
'redis' => [
// 驱动方式
'type' => 'redis',
// 服务器地址
'host' => env('REDIS_HOST', '127.0.0.1'),
// 服务器端口
'port' => env('REDIS_PORT', 6379),
// 服务器密码
'password' => env('REDIS_PASSWORD', ''),
// 数据库
'select' => env('REDIS_DB', 0),
// 缓存前缀
'prefix' => 'cache:',
// 默认缓存有效期 0表示永久缓存
'expire' => 0,
// Thinkphp官方没有这个参数由于生成的tag键默认不过期如果tag键数量很大避免长时间占用内存可以设置一个超过其他缓存的过期时间0为不设置
'tag_expire' => 86400 * 30,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 连接池配置(与 redis.php 对齐,生产可调大以减少等待)
'pool' => [
'max_connections' => (int) env('REDIS_POOL_MAX', 20),
'min_connections' => (int) env('REDIS_POOL_MIN', 2),
'wait_timeout' => (float) env('REDIS_POOL_WAIT_TIMEOUT', 1.0),
'idle_timeout' => 60,
'heartbeat_interval' => 50,
],
],
// 文件缓存
'file' => [
// 驱动方式
'type' => 'file',
// 设置不同的缓存保存目录
'path' => runtime_path() . '/file/',
],
],
];