I have a redis-db client in my Heroku app. I would like to run the CLIENT LIST
command (and a couple of other commands such as COMMAND GET
). How could I achieve this? I have tried
$redis.eval('CLIENT LIST')
$redis.exec('CLIENT LIST')
but no dice. How would I achieve this?
To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.
The CLIENT LIST command returns information and statistics about the client connections server in a mostly human readable format. You can use one of the optional subcommands to filter the list. The TYPE type subcommand filters the list by clients' type, where type is one of normal , master , replica , and pubsub .
Redis reads lists from left to right, and you can add new list elements to the head of a list (the “left” end) with the lpush command or the tail (the “right” end) with rpush . You can also use lpush or rpush to create a new list: lpush key value.
Redis accepts clients connections on the configured TCP port and on the Unix socket if enabled. When a new client connection is accepted the following operations are performed: The client socket is put in the non-blocking state since Redis uses multiplexing and non-blocking I/O.
You can use method_missing function:
$redis.method_missing("client", "list")
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