Skip to content

Commit

Permalink
chore(ARCO-283): remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 committed Nov 15, 2024
1 parent e886abc commit a130ce5
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions internal/cache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,6 @@ func (r *RedisStore) Del(hash *string, keys ...string) error {
return nil
}

// GetAllWithPrefix retrieves all key-value pairs that match a specific prefix.
func (r *RedisStore) GetAllWithPrefix(prefix string) (map[string][]byte, error) {
var cursor uint64
results := make(map[string][]byte)

for {
keys, newCursor, err := r.client.Scan(r.ctx, cursor, prefix+"*", 10).Result()
if err != nil {
return nil, errors.Join(ErrCacheFailedToScan, err)
}

for _, key := range keys {
value, err := r.client.Get(r.ctx, key).Result()
if errors.Is(err, redis.Nil) {
// Key has been removed between SCAN and GET, skip it
continue
} else if err != nil {
return nil, errors.Join(ErrCacheFailedToGet, err)
}
results[key] = []byte(value)
}

cursor = newCursor
if cursor == 0 {
break
}
}
return results, nil
}

// GetAllForHash retrieves all key-value pairs for a specific hash.
func (r *RedisStore) GetAllForHash(hash string) (map[string][]byte, error) {
values, err := r.client.HGetAll(r.ctx, hash).Result()
Expand Down

0 comments on commit a130ce5

Please sign in to comment.