Skip to content

Commit

Permalink
fix: Login performance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
M1saka10010 committed Nov 14, 2024
1 parent f7e48fc commit 803156f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@
'standing/<id:\d+>' => '/contest/standing2'
],
],
'session' => [
'class' => 'yii\web\DbSession',
// Set the following if you want to use DB component other than
// default 'db'.
// 'db' => 'mydb',
// To override default session table, set the following
// 'sessionTable' => 'my_session',
],
'security' => [
'passwordHashCost' => 10, // 尝试调整这个值
],
],
'params' => $params,
];
Expand Down
45 changes: 45 additions & 0 deletions migrations/m241114_082321_create_session.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use yii\db\Migration;

/**
* Class m241114_082321_create_session
*/
class m241114_082321_create_session extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('session', [
'id' => $this->char(40)->notNull(),
'expire' => $this->integer(),
'data' => $this->binary(),
]);
$this->addPrimaryKey('pk_session_id', 'session', 'id');
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('session');
}

/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m241114_082321_create_session cannot be reverted.\n";
return false;
}
*/
}

0 comments on commit 803156f

Please sign in to comment.