SETRANGE
AttentionThis page documents an earlier version. Go to the latest (v2.1)version.
Synopsis
SETRANGE key offset value
This command overwrites the string that is associated with the given key
with the given value
, starting from the given offset
.
- The
offset
cannot exceed 536870911. - If the
offset
is larger than the length of the specified string, the string will be padded with zeros up to theoffset
. - If the
key
does not exist, its associated string is an empty string. The resulted new string is constructed with zeros up to the givenoffset
and then appended with the givenvalue
. - If the
key
is associated with a non-string value, an error is raised.
Return Value
Returns the length of the resulted string after overwriting.
Examples
You can do this as shown below.
$ SET yugakey "YugaKey"
"OK"
$ SETRANGE yugakey 4 "Byte"
8
$ GET yugakey
"Yugabyte"
See Also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .