This commit is contained in:
2026-04-02 15:34:18 +08:00
parent 6697955054
commit c54b75611d
18 changed files with 2281 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package service
import (
"time"
)
type CharacterService struct {
cache *Cache
factory CharacterFactory
}
func NewCharacterService(cache *Cache, factory CharacterFactory) *CharacterService {
return &CharacterService{cache: cache, factory: factory}
}
func (s *CharacterService) StaticInfo(alter string, equVersion string) (map[string]any, error) {
key := "character:static:" + alter + ":" + equVersion
return GetOrLoad(s.cache, key, 15*time.Minute, func() (map[string]any, error) {
return s.factory.CharacterInfo(alter, equVersion)
})
}