11package cache
22
33import (
4- "context"
54 "sync"
65 "time"
76
@@ -11,14 +10,14 @@ import (
1110 "exusiai.dev/backend-next/internal/model"
1211 modelv2 "exusiai.dev/backend-next/internal/model/v2"
1312 "exusiai.dev/backend-next/internal/pkg/cache"
14- "exusiai.dev/backend-next/internal/repo"
1513)
1614
1715type Flusher func () error
1816
1917var (
2018 AccountByID * cache.Set [model.Account ]
2119 AccountByPenguinID * cache.Set [model.Account ]
20+ AccountExistence * cache.Set [int ]
2221
2322 ItemDropSetByStageIDAndRangeID * cache.Set [[]int ]
2423 ItemDropSetByStageIdAndTimeRange * cache.Set [[]int ]
@@ -73,18 +72,15 @@ var (
7372
7473 LastModifiedTime * cache.Set [time.Time ]
7574
76- Properties map [string ]string
77-
7875 once sync.Once
7976
8077 SetMap map [string ]Flusher
8178 SingularFlusherMap map [string ]Flusher
8279)
8380
84- func Initialize (propertyRepo * repo. Property ) {
81+ func Initialize () {
8582 once .Do (func () {
8683 initializeCaches ()
87- populateProperties (propertyRepo )
8884 })
8985}
9086
@@ -116,9 +112,11 @@ func initializeCaches() {
116112 // account
117113 AccountByID = cache.NewSet [model.Account ]("account#accountId" )
118114 AccountByPenguinID = cache.NewSet [model.Account ]("account#penguinId" )
115+ AccountExistence = cache.NewSet [int ]("accountExistence#accountId" )
119116
120117 SetMap ["account#accountId" ] = AccountByID .Flush
121118 SetMap ["account#penguinId" ] = AccountByPenguinID .Flush
119+ SetMap ["accountExistence#accountId" ] = AccountExistence .Flush
122120
123121 // drop_info
124122 ItemDropSetByStageIDAndRangeID = cache.NewSet [[]int ]("itemDropSet#server|stageId|rangeId" )
@@ -239,15 +237,3 @@ func initializeCaches() {
239237
240238 SetMap ["lastModifiedTime#key" ] = LastModifiedTime .Flush
241239}
242-
243- func populateProperties (repo * repo.Property ) {
244- Properties = make (map [string ]string )
245- properties , err := repo .GetProperties (context .Background ())
246- if err != nil {
247- panic (err )
248- }
249-
250- for _ , property := range properties {
251- Properties [property .Key ] = property .Value
252- }
253- }
0 commit comments