Redis APPEND – How to append a string to a existing string value in redis

1 month ago Lalit Bhagtani 0

In this tutorial, we will learn about how to append a string to a existing string value stored at the key, by using a COMMAND – APPEND. If key doesn’t exist in redis datastore, it is first created and set to empty string before performing the append operation. Error is returned, if key exist but value stored at the key is not a string. The syntax of redis APPEND command is as follows :-

Syntax :-

redis host:post> APPEND <key name>

Output :- 

(integer) value, representing the number of characters in the string.
Error, if key exist and value stored at the key is not a string.

Example :-

Redis APPEND

References :-

  1. APPEND Command Docs

That’s all for how to append a string to a existing string value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.