2 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN">
5 <link type=
"text/css" rel=
"stylesheet" href=
"style.css" />
12 <img style=
"border:none" alt=
"Redis Documentation" src=
"redis.png">
16 <div id=
"pagecontent">
18 <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
19 <b>AppendCommand: Contents
</b><br> <a href=
"#APPEND _key_ _value_">APPEND _key_ _value_
</a><br> <a href=
"#Return value">Return value
</a><br> <a href=
"#Examples">Examples
</a>
22 <h1 class=
"wikiname">AppendCommand
</h1>
29 #sidebar
<a href=
"StringCommandsSidebar.html">StringCommandsSidebar
</a><h1><a name=
"APPEND _key_ _value_">APPEND _key_ _value_
</a></h1>
30 <i>Time complexity: O(
1). The amortized time complexity is O(
1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.
</i><blockquote>If the
<i>key
</i> already exists and is a string, this command appends theprovided value at the end of the string.If the
<i>key
</i> does not exist it is created and set as an empty string, soAPPEND will be very similar to SET in this special case.
</blockquote>
31 <h2><a name=
"Return value">Return value
</a></h2><a href=
"ReplyTypes.html">Integer reply
</a>, specifically the total length of the string after the append operation.
<h2><a name=
"Examples">Examples
</a></h2><pre class=
"codeblock python" name=
"code">
32 redis
> exists mykey
34 redis
> append mykey
"Hello
"
36 redis
> append mykey
"World
"
39 "Hello World
"