Redis String: Getrange
Getrange key start end
Redis GETRANGE command is used to get the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string.
The function handles out of range requests by limiting the resulting range to the actual length of the string.
Syntax:
GETRANGE KEY_NAME start end
Available since
2.4.0.
Return Value
Simple string reply.
Return Value Type
String
Example: Redis GETRANGE
First, set a key in redis and then get some part of it.
redis 127.0.0.1:6379> SET mykey "This is my test key" OK redis 127.0.0.1:6379> GETRANGE mykey 0 3 "This" redis 127.0.0.1:6379> GETRANGE mykey 0 -1 "This is my test key"
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics