Latest web development tutorials

Redis Setrange command

Redis string (string)

Redis Setrange command overwrites the string value for a given key stored in the specified string, position covering offset offset from the start.

grammar

redis Setrange basic command syntax is as follows:

redis 127.0.0.1:6379> SETRANGE KEY_NAME OFFSET VALUE

Available versions

> = 2.2.0

return value

String length is modified.

Examples

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 (string)