English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis Getrange command is used to retrieve the substring of the string stored at the specified key. The substring is determined by the two offset values of start and end (including start and end).
The basic syntax of the redis Getrange command is as follows:
redis 127.0.0.1:6379> GETRANGE KEY_NAME start end
>= 2.4.0
Extract the substring obtained.
Firstly, set the value of mykey and extract the 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"