Redis - String Setrange Command



Redis SETRANGE command is used to overwrite a part of a string at the key starting at the specified offset.

Return Value

Integer reply, the length of the string after it was modified by the command.

Syntax

Following is the basic syntax of Redis SETRANGE command.

redis 127.0.0.1:6379> SETRANGE KEY_NAME OFFSET VALUE

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.htm
Advertisements