- Redis Basics
- Redis - Home
- Redis - Overview
- Redis - Environment
- Redis - Configuration
- Redis - Data types
- Redis Commands
- Redis - Commands
- Redis - Keys
- Redis - Strings
- Redis - Hashes
- Redis - Lists
- Redis - Sets
- Redis - Sorted Sets
- Redis - HyperLogLog
- Redis - Publish Subscribe
- Redis - Transactions
- Redis - Scripting
- Redis - Connections
- Redis - Server
- Redis Advanced
- Redis - Backup
- Redis - Security
- Redis - Benchmarks
- Redis - Client Connection
- Redis - Pipelining
- Redis - Partitioning
- Redis - Java
- Redis - Php
- Redis Useful Resources
- Redis - Quick Guide
- Redis - Useful Resources
- Redis - Discussion
Redis - List Lrange Command
Redis LRANGE command returns the specified elements of the list stored at the key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element, and so on. These offsets can also be negative numbers indicating offsets starting at the end of the list. For example, -1 is the last element of the list, -2 the penultimate, and so on.
Return Value
Array reply, list of elements in the specified range.
Syntax
Following is the basic syntax of Redis LRANGE command.
redis 127.0.0.1:6379> LRANGE KEY_NAME START END
Example
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) "foo" 2) "bar" 3) "bar"
redis_lists.htm
Advertisements