- 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 - Set Sadd Command
Redis SADD command is used to add members to a set stored at the key. If the member already exists, then it is ignored. If the key does not exist, then a new set is created and the members are added into it. If the value stored at the key is not set, then an error is returned.
Return Value
Integer reply, the number of elements that were added to the set, not including all the elements already present in the set.
Syntax
Following is the basic syntax of Redis SADD command.
redis 127.0.0.1:6379> SADD KEY_NAME VALUE1..VALUEN
Example
redis 127.0.0.1:6379> SADD myset "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset "foo" (integer) 1 redis 127.0.0.1:6379> SADD myset "hello" (integer) 0 redis 127.0.0.1:6379> SMEMBERS myset 1) "hello" 2) "foo"
redis_sets.htm
Advertisements
To Continue Learning Please Login
Login with Google