English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Redis Lrange returns elements from the list within the specified range, which is specified by the offset START and END. where 0 represents the first element of the list, 1 represents the second element of the list, and so on. You can also use negative indices to, -1 represents the last element of the list, -2 represents the second-to-last element of the list, and so on.
The basic syntax of the redis Lrange command is as follows:
redis 127.0.0.1:6379> LRANGE KEY_NAME START END
>= 1.0.0
A list containing elements within the specified range.
redis> RPUSH mylist "one" (integer) 1 redis> RPUSH mylist "two" (integer) 2 redis> RPUSH mylist "three" (integer) 3 redis> LRANGE mylist 0 0 1) "one" redis> LRANGE mylist -3 2 1) "one" 2) "two" 3) "three" redis> LRANGE mylist -100 100 1) "one" 2) "two" 3) "three" redis> LRANGE mylist 5 10 (empty list or set) redis>