Search code examples
redisredis-cli

How to set to redis value if the value contain multiline?


I am not able to set multiline value to redis? is there any better way to do?


Solution

  • I found the answer.

    Just do like

    printf "*3\r\n\$3\r\nset\r\n\$3\r\nfoo\r\n\$15\r\nMyGroup\r\nGroupA\r\n" | nc localhost 6379
    

    * Specify the rows \$ count the character