Browse Source

update 群组成员数量 && 缓存时间缩短

master
dengbiao 7 months ago
parent
commit
05e359af6b
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      internal/logic/domain/group/repo/group_cache.go
  2. +1
    -1
      internal/logic/domain/group/repo/group_repo.go

+ 2
- 2
internal/logic/domain/group/repo/group_cache.go View File

@@ -44,7 +44,7 @@ func (c *groupCache) GetLimit(limit string, groupId int64) (*model.Group, error)

// Set 设置群组缓存
func (c *groupCache) Set(group *model.Group) error {
err := db.RedisUtil.Set(GroupKey+strconv.FormatInt(group.Id, 10), group, 24*time.Hour)
err := db.RedisUtil.Set(GroupKey+strconv.FormatInt(group.Id, 10), group, 4*time.Hour)
if err != nil {
return gerrors.WrapError(err)
}
@@ -53,7 +53,7 @@ func (c *groupCache) Set(group *model.Group) error {

// SetLimit 设置群组缓存
func (c *groupCache) SetLimit(limit string, group *model.Group) error {
err := db.RedisUtil.Set(GroupKey+limit+":"+strconv.FormatInt(group.Id, 10), group, 24*time.Hour)
err := db.RedisUtil.Set(GroupKey+limit+":"+strconv.FormatInt(group.Id, 10), group, 4*time.Hour)
if err != nil {
return gerrors.WrapError(err)
}


+ 1
- 1
internal/logic/domain/group/repo/group_repo.go View File

@@ -30,7 +30,7 @@ func (*groupRepo) Get(groupId int64) (*model.Group, error) {
group.Members = members
if group.UserNum != int32(len(group.Members)) {
group.UserNum = int32(len(group.Members))
err = GroupRepo.Save(group)
err = GroupDao.Save(group)
if err != nil {
return nil, err
}


Loading…
Cancel
Save