yumi-golang/internal/service/baishun/game_list_cache.go
2026-04-24 13:04:06 +08:00

26 lines
480 B
Go

package baishun
import "context"
const javaGameListCachePattern = "GAME_LIST*"
func (s *BaishunService) clearJavaGameListCache(ctx context.Context) {
if s.repo.Redis == nil {
return
}
var cursor uint64
for {
keys, nextCursor, err := s.repo.Redis.Scan(ctx, cursor, javaGameListCachePattern, 100).Result()
if err != nil {
return
}
if len(keys) > 0 {
_ = s.repo.Redis.Del(ctx, keys...).Err()
}
if nextCursor == 0 {
return
}
cursor = nextCursor
}
}