Quantcast
Channel: StackExchange.Redis Scan x amount of keys - Stack Overflow
Viewing all articles
Browse latest Browse all 3

StackExchange.Redis Scan x amount of keys

$
0
0

I have a redis db that has thousands of keys and I'm currently running the following line to get all the keys:

string[] keysArr = keys.Select(key => (string)key).ToArray();

But because I have a lot of keys this takes a long time. I want to limit the number of keys being read. So I'm trying to run an execute command where I get 100 keys at a time:

var keys = Redis.Connection.GetDatabase(dbNum).Execute("scan", 0, "count", 100);

This command successfully runs the command, however unable to access the the value as it is private, and unable to cast it even though RedisResult classs provides a explicit cast to it:

public static explicit operator string[] (RedisResult result);

Any ideas to get x amount of keys at a time from redis?

Thanks


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images