Redis Lrange command
Redis Lrange returns a list of the elements specified interval, the interval to the specified 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 a negative index to -1 means the last element of the list, -2 represents the second to last element of a list, and so on.
grammar
redis Lrange basic command syntax is as follows:
redis 127.0.0.1:6379> LRANGE KEY_NAME START END
Available versions
> = 1.0.0
return value
A list containing the elements specified interval.
Examples
redis 127.0.0.1:6379> LPUSH list1 "foo" (integer) 1 redis 127.0.0.1:6379> LPUSH list1 "bar" (integer) 2 redis 127.0.0.1:6379> LPUSHX list1 "bar" (integer) 0 redis 127.0.0.1:6379> LRANGE list1 0 -1 1) "bar" 2) "bar" 3) "foo"