I am using StackExchange.Redis in my application to store key/values. I need to flush the entire db now which Redis is using. I found a way via command How do I delete everything in Redis? but how can I do this with StackExchange.Redis? I was not able to find any method for that?
I searched for Empty, RemoveAll etc on IDatabase object and found nothing.
The easiest way is to use FlushDatabase method or FlushDatabaseAsync from IServer
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost,allowAdmin=true");
var server = redis.GetServer("localhost");
server.FlushDatabase();
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