Redis Getrange Command
The Redis Getrange command is used to get a substring of the string stored at the specified key. The substring's range is determined by the start and end offsets (both start and end are inclusive).
Syntax
The basic syntax of the redis Getrange command is as follows:
redis 127.0.0.1:6379> GETRANGE KEY_NAME start end
Available Versions
>= 2.4.0
Return Value
The substring obtained by the slice.
Example
First, set the value of mykey and get a substring.
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"Other Extensions
Redis String