mirror of
https://github.com/aoaostar/toolbox.git
synced 2025-12-24 21:14:27 +00:00
feat: 🎸 添加cache、session对redis的支持
This commit is contained in:
parent
a1ee6314ac
commit
09fd680c8c
22
.env.example
22
.env.example
@ -15,4 +15,24 @@ PREFIX = toolbox_
|
||||
DEBUG = false
|
||||
|
||||
[LANG]
|
||||
default_lang = zh-cn
|
||||
default_lang = zh-cn
|
||||
|
||||
[cache]
|
||||
driver = file
|
||||
expire = 3600
|
||||
|
||||
[cache_redis]
|
||||
host = 127.0.0.1
|
||||
port = 6379
|
||||
password =
|
||||
select = 0
|
||||
|
||||
[session]
|
||||
driver = file
|
||||
expire = 25200
|
||||
|
||||
[session_redis]
|
||||
host = 127.0.0.1
|
||||
port = 6379
|
||||
password =
|
||||
select = 1
|
||||
@ -16,24 +16,35 @@ return [
|
||||
// 缓存保存目录
|
||||
'path' => '',
|
||||
// 缓存前缀
|
||||
'prefix' => 'aoaostar_',
|
||||
'prefix' => 'toolbox',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 3600,
|
||||
'expire' => env('cache.expire', 3600),
|
||||
// 缓存标签前缀
|
||||
'tag_prefix' => 'tag:',
|
||||
'tag_prefix' => 'toolbox:',
|
||||
// 序列化机制 例如 ['serialize', 'unserialize']
|
||||
'serialize' => [],
|
||||
],
|
||||
'redis' => [
|
||||
// 驱动方式
|
||||
'type' => 'Redis',
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'password' => '',
|
||||
'select' => 0,
|
||||
'host' => env('cache.redis.host', '127.0.0.1'),
|
||||
'port' => env('cache.redis.port', 6379),
|
||||
'password' => env('cache.redis.password', ''),
|
||||
'select' => env('cache.redis.select', 0),
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 3600,
|
||||
'prefix' => 'aoaostar_toolbox_',
|
||||
'expire' => env('cache.expire', 3600),
|
||||
'prefix' => 'toolbox_',
|
||||
],
|
||||
'session_redis' => [
|
||||
// 驱动方式
|
||||
'type' => 'Redis',
|
||||
'host' => env('session.redis.host', '127.0.0.1'),
|
||||
'port' => env('session.redis.port', 6379),
|
||||
'password' => env('session.redis.password', ''),
|
||||
'select' => env('session.redis.select', 1),
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => env('session.expire', 86400 * 7),
|
||||
'prefix' => 'session_',
|
||||
],
|
||||
// 更多的缓存连接
|
||||
],
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// cookie 保存时间
|
||||
'expire' => 0,
|
||||
'expire' => 86400 * 360,
|
||||
// cookie 保存路径
|
||||
'path' => '/',
|
||||
// cookie 有效域名
|
||||
|
||||
@ -9,11 +9,11 @@ return [
|
||||
// SESSION_ID的提交变量,解决flash上传跨域
|
||||
'var_session_id' => '',
|
||||
// 驱动方式 支持file cache
|
||||
'type' => 'file',
|
||||
'type' => env('session.driver', 'file') === 'file'? 'file': 'cache',
|
||||
// 存储连接标识 当type使用cache的时候有效
|
||||
'store' => null,
|
||||
'store' => 'session_' . env('session.driver', 'redis'),
|
||||
// 过期时间
|
||||
'expire' => 86400*7,
|
||||
'expire' => env('session.expire', 86400 * 7),
|
||||
// 前缀
|
||||
'prefix' => 'aoaostar_session_',
|
||||
'prefix' => '',
|
||||
];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user