Easy Tutorial
❮ Connection Quit Server Flushall ❯

Redis Setrange Command

Redis Strings

The Redis Setrange command overwrites the string value stored at a given key with the specified string, starting at the offset position.

Syntax

The basic syntax for the redis Setrange command is as follows:

redis 127.0.0.1:6379> SETRANGE KEY_NAME OFFSET VALUE

Available Versions

= 2.2.0

Return Value

The length of the string after it has been modified.

Example

redis 127.0.0.1:6379> SET key1 "Hello World"
OK
redis 127.0.0.1:6379> SETRANGE key1 6 "Redis"
(integer) 11
redis 127.0.0.1:6379> GET key1
"Hello Redis"

Redis Strings

❮ Connection Quit Server Flushall ❯