Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing Redis Console commands in c#

I need to get the "CLIENT LIST" output from redis console to be used in my c# application, is there a way to execute that command with the ConnectionMultiplexer? Or is there a built in method to find that information?

like image 966
PedroNeves Avatar asked Sep 14 '25 15:09

PedroNeves


1 Answers

CLIENT LIST is a "server" command, not a "database" command (as differentiated here), so you need to use IServer / GetServer() instead of IDatabase / GetDatabase(). The link shown also shows how to do this. Once you have that: there are ClientList and ClientListAsync methods that deal with all the parsing into a ClientInfo instance.

If it wasn't there, then the fallback options would be IDatabase.Execute[Async] (to issue an arbitrary raw command) or IDatabase.ScriptEvaluate[Async] (to issue Lua script).

like image 150
Marc Gravell Avatar answered Sep 16 '25 07:09

Marc Gravell