26 lines
480 B
Go
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
|
|
}
|
|
}
|