I use StackExchange.Redis in C# program. Is there any method to clear redis or delete all key-value pairs?
You may be looking for FLUSHDB
/ FLUSHALL
. Despite the name, this is not a "database" level command, but rather is a "server" level command (meaning: in the context of a redis cluster, it only impacts one server, not the entire keyspace; this distinction is explained more here), hence it is accessed from IServer
in SE.Redis:
ConnexctionMultiplexer redis = ...
var server = redis.GetServer({your server here});
server.FlushDatabase(); // or await server.FlushDatabaseAsync();