Created
April 26, 2010 17:55
-
-
Save antirez/379653 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEFORE: | |
redis> set foo "hello world" | |
Wrong number of arguments for 'set' | |
$ cat /bin/ls | ./redis-cli set x | |
OK | |
$ ./redis-cli | |
redis> substr x 0 1023 | |
ELF>�&@@0�@8 @@@@@@�88@8@@@T�T� ��a�aP���a�TT@T@DDP�td0�0�A0�AttQ�tR�td��a�a >k2KQM$E81B[aO._Ph)Z-!G,`J 7TRmGNUd�k{�L�:ٔ�I�E^�&�aoNc W\*fbel3FSjY^]DCX | |
... garbage ... :) | |
AFTER: | |
$ ./redis-cli | |
redis> set x "Hello World!" | |
OK | |
redis> get x | |
"Hello World!" | |
Now you can quote with "...". Also things are printed back as string representations: | |
redis> set x "Hello\nWorld\n" | |
OK | |
redis> get x | |
"Hello\nWorld\n" | |
So for instance you can see subtle differences when debugging: | |
redis> set y " " | |
OK | |
redis> set z "" | |
OK | |
redis> mget y z | |
1. " " | |
2. "" | |
And now it's possible to deal with binary stuff: | |
redis> substr lsbinary 0 1023 | |
"\xca\xfe\xba\xbe\x00\x00\x00\x02\x01\x00\x00\a\x80\x00\x00\.... and so forth | |
But if you are redirecting to a file, it's safe: | |
$ ./redis-cli get lsbinary > /tmp/foobar | |
$ md5sum /tmp/foobar /bin/ls | |
026e646e18f2714dbbe1545bf8b9c339 /tmp/foobar | |
026e646e18f2714dbbe1545bf8b9c339 /bin/ls | |
At this point we need a wiki page for redis-cli, I'll use this as a template. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aww... i feel like it was made just for me. ;)