Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Setrange command

Redis Setrange command

Redis string

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

Syntax

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



redis 127.0.0.1:6379> SETRANGE KEY_NAME OFFSET VALUE

Available Version

= 2.2.0

Return Value

The length of the modified string.

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 string