使用redis存储缓存(包括session)

解决session lock堵塞问题
This commit is contained in:
Chenx221 2024-02-20 14:15:12 +08:00
parent 1727f34516
commit ce049b9c96
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021
2 changed files with 16 additions and 2 deletions

View File

@ -34,7 +34,9 @@
"gemorroj/archive7z": "^5.7",
"npm-asset/viewerjs": "^1.11",
"npm-asset/plyr": "^3.7",
"ext-fileinfo": "*"
"ext-fileinfo": "*",
"npm-asset/ace-builds": "^1.32",
"yiisoft/yii2-redis": "^2.0"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.1.0",

View File

@ -18,8 +18,11 @@ $config = [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '9vuTNyfQqTOWY8fhAajrAhOfX_uaZqZZ',
],
// 'cache' => [
// 'class' => 'yii\caching\FileCache',
// ],
'cache' => [
'class' => 'yii\caching\FileCache',
'class' => 'yii\redis\Cache',
],
'user' => [
'identityClass' => 'app\models\User',
@ -44,6 +47,15 @@ $config = [
],
],
],
'session' => [
'class' => 'yii\redis\Session',
],
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
],
'db' => $db,
/*
'urlManager' => [