Add a cache layer in auth to speed up auth

This commit is contained in:
2024-03-23 00:28:27 +08:00
parent 211959167a
commit b69ac44885
11 changed files with 202 additions and 69 deletions

View File

@ -36,11 +36,14 @@ func main() {
}
// Connect to database
if err := database.NewSource(); err != nil {
if err := database.NewGorm(); err != nil {
log.Fatal().Err(err).Msg("An error occurred when connect to database.")
} else if err := database.RunMigration(database.C); err != nil {
log.Fatal().Err(err).Msg("An error occurred when running database auto migration.")
}
if err := database.NewBolt(); err != nil {
log.Fatal().Err(err).Msg("An error occurred when init bolt db.")
}
// External
// All the things are optional so when error occurred the server won't crash
@ -83,4 +86,6 @@ func main() {
log.Info().Msgf("Identity v%s is quitting...", identity.AppVersion)
quartz.Stop()
database.B.Close()
}