Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Login performance issue #167

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
*/
}
Loading