Flush / Empty db in StackExchange.Redis

I use StackExchange.Redis in my application to store keys / values. I need to clear all db that Redis uses. I found a way through the command How to delete everything in Redis? but how can I do this using StackExchange.Redis? I could not find any method for this?

I was looking for Empty, RemoveAll etc. on the IDatabase object and did not find anything.

+5
source share
1 answer

The easiest way is to use the FlushDatabase or FlushDatabaseAsync method with IServer

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); var server = redis.GetServer("localhost"); server.FlushDatabase(); 
+10
source

Source: https://habr.com/ru/post/1243201/


All Articles