I just fired up Redis and am playing around with it. The following works fine:
SET billybob "hello"
+OK
However, the following fails:
SET billybob "hey how are you"
-ERR syntax error
I thought SET worked for any key/value, and presumably a value can be any string... but not a string with spaces? What's the story here?
Description. Redis SET command is used to set some string value in redis key. If the key already holds a value, it is overwritten, regardless of its type.
The only difference between the commands HSET and HMSET is the return value of the commands.
Redis HSET command is used to set field in the hash stored at the key to value. If the key does not exist, a new key holding a hash is created. If the field already exists in the hash, it is overwritten.
The maximum allowed key size is 512 MB.
Maybe it is version related. This here works:
$ redis-cli --version
redis-cli 2.8.3
$ redis-cli SET billybob "hey how are you"
OK
$ redis-cli GET billybob
"hey how are you"
@jm3 Use the '-x' command line option for the redis-cli instead. Beware that it will add a "\n" at the end of your string:
$ echo "hey how are you"
hey how are you
$ echo "hey how are you" | redis-cli --pipe SET billybob
All data transferred. Waiting for the last reply...
ERR unknown command 'hey'
Last reply received from server.
errors: 1, replies: 1
$ echo "hey how are you" | redis-cli -x SET billybob
OK
$ redis-cli GET billybob
"hey how are you\n"
HTH
bernie
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