用户信息缓存时间

This commit is contained in:
xing 2022-10-06 21:35:36 +08:00
parent be5accaa10
commit 478888b392
3 changed files with 4 additions and 1 deletions

View File

@ -55,7 +55,7 @@ func InitActionsCommonCache() {
maxPostIdCache = cache.NewSliceCache[uint64](getMaxPostId, vars.Conf.MaxPostIdCacheTime) maxPostIdCache = cache.NewSliceCache[uint64](getMaxPostId, vars.Conf.MaxPostIdCacheTime)
usersCache = cache.NewMapCacheByBatchFn[uint64, models.WpUsers](getUsers, time.Hour) usersCache = cache.NewMapCacheByBatchFn[uint64, models.WpUsers](getUsers, vars.Conf.UserInfoCacheTime)
usersCache.SetCacheFunc(getUser) usersCache.SetCacheFunc(getUser)
} }

View File

@ -49,3 +49,5 @@ maxRequestNum: 500
singleIpSearchNum: 10 singleIpSearchNum: 10
# 文档最大id缓存时间 # 文档最大id缓存时间
maxPostIdCacheTime: 1h maxPostIdCacheTime: 1h
# 用户信息缓存时间
userInfoCacheTime: 24h

View File

@ -29,6 +29,7 @@ type Config struct {
MaxRequestNum int64 `yaml:"maxRequestNum"` MaxRequestNum int64 `yaml:"maxRequestNum"`
SingleIpSearchNum int64 `yaml:"singleIpSearchNum"` SingleIpSearchNum int64 `yaml:"singleIpSearchNum"`
MaxPostIdCacheTime time.Duration `yaml:"maxPostIdCacheTime"` MaxPostIdCacheTime time.Duration `yaml:"maxPostIdCacheTime"`
UserInfoCacheTime time.Duration `yaml:"userInfoCacheTime"`
} }
type Mysql struct { type Mysql struct {