Redis SCAN
command with small COUNT
for large keys, not all keys always returned.
- 10000 keys, 1000 COUNT = return all keys.
- 10000 keys, 10 COUNT = return not all keys.
I want to get all keys for so many keys(100 million), without using commands like keys
.
What should i do?
var keys []string
redis.ForEachMaster(ctx, func(ctx context.Context, master *redis.Client) error {
iter := master.Scan(ctx, cursor, match, count).Iterator()
for iter.Next(ctx) {
keys = append(keys, iter.Val())
}
return nil
});