Redis Getrange command
Redis Getrange command is used to get a substring in the string stored in the specified key. String interception range by the start and end offsets two decisions (including start and end included).
grammar
redis Getrange basic command syntax is as follows:
redis 127.0.0.1:6379> GETRANGE KEY_NAME start end
Available versions
> = 2.4.0
return value
Interception substring obtained.
Examples
First, set the value mykey and interception string.
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"