Redis String: SETRANGE
SETRANGE key offset value
Redis SETRANGE command is used to overwrite part of a string at key starting at the specified offset for the entire length of the value. If the offset is larger than the current length of the string at the key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings.
The maximum offset that you can set is 229-1 (536870911), as Redis Strings are limited to 512 megabytes.
Syntax:
SETRANGE KEY_NAME OFFSET VALUE
Available since
2.2.0.
Return Value
Integer replies, the length of the string after it was modified by the command.
Return Value Type
Integer
Example: Redis SETRANGE
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"
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework