SETRANGE

Since 1.1.0Strings

Syntax

SETRANGE key offset value
  • Flags: write
  • ACL categories: @slow, @string, @write
  • Arity: 4

Overwrites the string at key from byte offset on with value. If the string is shorter than offset, it is padded with zero bytes first. A missing key is created.

Reply

  • The length of the string afterwards.

Examples

> SET k "hello world"
OK
> SETRANGE k 6 there
(integer) 11
> GET k
"hello there"
> SETRANGE pad 5 x
(integer) 6
> GET pad
"\x00\x00\x00\x00\x00x"