Merge branch 'dev' into alpha

pull/398/head
Michael Li 1 year ago
commit 65aadafa4d
No known key found for this signature in database

@ -13,6 +13,7 @@ Cache:
IndexTweetsExpire: 120 # 获取广场推文列表过期时间,单位秒, 默认120s
OnlineUserExpire: 300 # 标记在线用户 过期时间,单位秒, 默认300s
UserInfoExpire: 300 # 获取用户信息过期时间,单位秒, 默认300s
UserRelationExpire: 600 # 用户关系信息过期时间,单位秒, 默认600s
EventManager: # 事件管理器的配置参数
MinWorker: 64 # 最小后台工作者, 设置范围[5, ++], 默认64
MaxEventBuf: 128 # 最大log缓存条数, 设置范围[10, ++], 默认128

@ -104,6 +104,7 @@ type cacheConf struct {
IndexTweetsExpire int64
OnlineUserExpire int64
UserInfoExpire int64
UserRelationExpire int64
}
type eventManagerConf struct {

@ -51,6 +51,7 @@ type cacheMyFriendIdsEvent struct {
ac core.AppCache
urs core.UserRelationService
userIds []int64
expire int64
}
type cacheMyFollowIdsEvent struct {
@ -59,6 +60,7 @@ type cacheMyFollowIdsEvent struct {
urs core.UserRelationService
userId int64
key string
expire int64
}
func OnExpireIndexTweetEvent(userId int64) {
@ -106,6 +108,7 @@ func OnCacheMyFriendIdsEvent(urs core.UserRelationService, userIds ...int64) {
userIds: userIds,
urs: urs,
ac: _appCache,
expire: conf.CacheSetting.UserRelationExpire,
})
}
@ -121,6 +124,7 @@ func OnCacheMyFollowIdsEvent(urs core.UserRelationService, userId int64, key ...
urs: urs,
key: cacheKey,
ac: _appCache,
expire: conf.CacheSetting.UserRelationExpire,
})
}
@ -188,7 +192,7 @@ func (e *cacheMyFriendIdsEvent) Action() error {
if err != nil {
return err
}
e.ac.Set(conf.KeyMyFriendIds.Get(userId), data, 0)
e.ac.Set(conf.KeyMyFriendIds.Get(userId), data, e.expire)
}
return nil
}
@ -211,6 +215,6 @@ func (e *cacheMyFollowIdsEvent) Action() (err error) {
if err != nil {
return err
}
e.ac.Set(e.key, data, 0)
e.ac.Set(e.key, data, e.expire)
return nil
}

Loading…
Cancel
Save