Redis Lrange Command
Redis Lrange returns the elements within the specified range of the list, where the range is specified by the offsets START and END. 0 is the first element of the list, 1 is the second, and so on. You can also use negative indices, where -1 is the last element, -2 is the second-to-last, and so on.
Syntax
The basic syntax of the redis Lrange command is as follows:
redis 127.0.0.1:6379> LRANGE KEY_NAME START END
Available Version
= 1.0.0
Return Value
A list containing the elements within the specified range.
Example
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>
Redis List