APPEND key value

If key already exists and is a string, this command appends the value at the end of the string. If key does not exist it is created and set as an empty string, so APPEND will be similar to SET in this special case.

@return

@integer-reply: the length of the string after the append operation.

@examples

redis> EXISTS mykey
TBD
redis> APPEND mykey "Hello"
TBD
redis> APPEND mykey " World"
TBD
redis> GET mykey
TBD
redis> ```
TBD
redis> ## Pattern: Time series
TBD
redis> The [`APPEND`](/commands/append) command can be used to create a very compact representation of a
TBD
redis> list of fixed-size samples, usually referred as _time series_.
TBD
redis> Every time a new sample arrives we can store it using the command
TBD
redis> ```
TBD
redis> APPEND timeseries "fixed-size sample"
TBD
redis> ```
TBD
redis> Accessing individual elements in the time series is not hard:
TBD
redis> * [`STRLEN`](/commands/strlen) can be used in order to obtain the number of samples.
TBD
redis> * [`GETRANGE`](/commands/getrange) allows for random access of elements.
TBD
redis> If our time series have associated time information we can easily implement
TBD
redis> a binary search to get range combining [`GETRANGE`](/commands/getrange) with the Lua scripting
TBD
redis> engine available in Redis 2.6.
TBD
redis> * [`SETRANGE`](/commands/setrange) can be used to overwrite an existing time series.
TBD
redis> The limitation of this pattern is that we are forced into an append-only mode
TBD
redis> of operation, there is no way to cut the time series to a given size easily
TBD
redis> because Redis currently lacks a command able to trim string objects.
TBD
redis> However the space efficiency of time series stored in this way is remarkable.
TBD
redis> Hint: it is possible to switch to a different key based on the current Unix
TBD
redis> time, in this way it is possible to have just a relatively small amount of
TBD
redis> samples per key, to avoid dealing with very big keys, and to make this pattern
TBD
redis> more friendly to be distributed across many Redis instances.
TBD
redis> An example sampling the temperature of a sensor using fixed-size strings (using
TBD
redis> a binary format is better in real implementations).
TBD
redis> ```cli
TBD
redis> APPEND ts "0043"
TBD
redis> APPEND ts "0035"
TBD
redis> GETRANGE ts 0 3
TBD
redis> GETRANGE ts 4 7