问题
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?
回答1:
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).
来源:https://stackoverflow.com/questions/49029963/executing-redis-console-commands-in-c-sharp