February 2018
Intermediate to advanced
382 pages
11h 33m
English
To understand the Redis protocol, take the following steps:
Instead of sending the command PING in redis-cli, let's build the command using RESP:
$ echo -e "*1\r\n\$4\r\nPING\r\n" | nc 127.0.0.1 6379+PONG
$ echo -e "*3\r\n\$3\r\nset\r\n\$5\r\nmykey\r\n\$1\r\n1\r\n" | nc 127.0.0.1 6379+OK$ echo -e "*2\r\n\$4\r\nINCR\r\n\$5\r\nmykey\r\n" | nc 127.0.0.1 6379:2
You may encounter the following error when you send a non-existent command:
$ echo -e "*2\r\n\$3\r\ngot\r\n\$3\r\nfoo\r\n" | nc 127.0.0.1 6379-ERR unknown command 'got'
Multi-commands can be combined and sent to the Redis Server in a single ...
Read now
Unlock full access