From bd25f041a21bbcf569f6c0ec7c792f57a65e1860 Mon Sep 17 00:00:00 2001 From: tianjun Date: Wed, 18 Jan 2023 15:14:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8xorm=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dao/index.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/dao/index.go b/core/dao/index.go index b765ce4..a66f082 100644 --- a/core/dao/index.go +++ b/core/dao/index.go @@ -28,8 +28,7 @@ func initDatabase() { ds.Host, ds.Port, ds.Database, - ds.Charset, - ) + ds.Charset) SqlDB, _ = xorm.NewEngine(ds.DbType, jdbc) if err != nil { common.FatalfLog("db error: %#v\n", err.Error()) @@ -50,6 +49,8 @@ func initDatabase() { } }(SqlDB) SqlDB.ShowSQL(true) + // 开启缓存 + SqlDB.SetDefaultCacher(xorm.NewLRUCacher(xorm.NewMemoryStore(), 1000)) } func initRedis() { // 配置redis数据库