mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-06 22:33:41 +08:00
feat: use cache to avoid database access (#158)
This commit is contained in:
6
main.go
6
main.go
@@ -47,12 +47,18 @@ func main() {
|
||||
|
||||
// Initialize options
|
||||
model.InitOptionMap()
|
||||
if common.RedisEnabled {
|
||||
model.InitChannelCache()
|
||||
}
|
||||
if os.Getenv("SYNC_FREQUENCY") != "" {
|
||||
frequency, err := strconv.Atoi(os.Getenv("SYNC_FREQUENCY"))
|
||||
if err != nil {
|
||||
common.FatalLog(err)
|
||||
}
|
||||
go model.SyncOptions(frequency)
|
||||
if common.RedisEnabled {
|
||||
go model.SyncChannelCache(frequency)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize HTTP server
|
||||
|
||||
Reference in New Issue
Block a user