- 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 Lset Command
Redis LSET command sets the list element at an index to the value. For more information on the index argument, see LINDEX. An error is returned for out of range indexes.
Return Value
String reply, OK.
Syntax
Following is the basic syntax of Redis LSET command.
redis 127.0.0.1:6379> LSET KEY_NAME INDEX VALUE
Example
redis 127.0.0.1:6379> RPUSH mylist "hello" (integer) 1 redis 127.0.0.1:6379> RPUSH mylist "hello" (integer) 2 redis 127.0.0.1:6379> RPUSH mylist "foo" (integer) 3 redis 127.0.0.1:6379> RPUSH mylist "hello" (integer) 4 redis 127.0.0.1:6379> LSET mylist 0 "bar" OK redis 127.0.0.1:6379> LRANGE mylist 0 -1 1: "bar" 2) "hello" 3) "foo" 4) "hello"
redis_lists.htm
Advertisements