Skip to content

Commit

Permalink
remove cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jul 15, 2024
1 parent 031a68e commit c2feab5
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions internal/group/group.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ func (s *serviceImpl) findByUserIdNoCache(userId string) (*model.Group, error) {
}

func (s *serviceImpl) FindByToken(_ context.Context, in *proto.FindByTokenGroupRequest) (*proto.FindByTokenGroupResponse, error) {
cacheKey := groupByTokenKey(in.Token)
var cachedGroup proto.FindByTokenGroupResponse
if err := s.cache.GetValue(cacheKey, &cachedGroup); err == nil {
s.log.Named("FindByToken").Info("GetValue: Group found in cache", zap.String("token", in.Token))
return &cachedGroup, nil
}

group := &model.Group{}
if err := s.repo.FindByToken(in.Token, group); err != nil {
s.log.Named("FindByToken").Error("FindByToken: ", zap.Error(err))
Expand All @@ -149,11 +142,6 @@ func (s *serviceImpl) FindByToken(_ context.Context, in *proto.FindByTokenGroupR
Leader: leaderInfo,
}

if err := s.cache.SetValue(cacheKey, &res, s.conf.CacheTTL); err != nil {
s.log.Named("FindByToken").Error("SetValue: ", zap.Error(err))
return nil, status.Error(codes.Internal, "failed to cache group")
}

return &res, nil
}

Expand Down

0 comments on commit c2feab5

Please sign in to comment.