I have a scenario where I have to get all the keys (string type) matching some prefix. For example, I have below keys
1. ABC.10
2. ABC.11
3. ABC.12
4. XYZ.10
5. XYZ.11
6. XYZ.12
And I need to get all keys matching XYZ using Stackexchange.Redis C#.
I found the way out to get the keys from Redis
ConnectionMultiplexer con = RedisConnectionFactory.GetConnection();
IServer server = con.GetServer("redisdb:6379");
foreach (var key in server.Keys(DB_Number, "XYZ.*", 1000))
{
//logic
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With