启用xorm缓存

This commit is contained in:
骑着蜗牛追导弹 2023-01-18 15:14:05 +08:00
parent 438d727b2d
commit bd25f041a2
1 changed files with 3 additions and 2 deletions

View File

@ -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数据库