“sdiff” command
Shows difference of two sets by displaying those elements, elements that are in set 1 butt not in set 2.
Syntax:
sdiff set_name1 set_name2
Example:
sdiff FavSub1 FavSub2
Explanation:
FavSub1 and FavSub2 are two sets that contain favorite subjects of User1 and User2, respectively. Elements of FavSub1 and FavSub2 are {Computer Science, Data Science} and {Computer Science, Math’s}. The ouput of this command is showing diffrence of two sets as their elements that is the elements that are in FavSub1 but not in FavSub2. Hence, output is Data Science.
Complete Guide to Redis Commands
Redis is an open-source, advanced key-value store and an apt solution for building high-performance, scalable web applications. Redis has three main peculiarities that set it apart:
- Redis holds its database entirely in the memory, using the disk only for persistence.
- Redis has a relatively rich set of data types compared to many key-value data stores.
- Redis can replicate data to any number of slaves.
Table of Content
- 1. KEY-VALUE OPERATIONS
- 1.1) SET:
- 1.2) GET:
- 1.4) DEL:
- 1.4) EXISTS:
- 1.5) TTL:
- 1.6) EXPIRE :
- 1.7) INCR
- 1.8) DECR
- 1.9) APPEND
- 2. LISTS:
- 2.1) LPUSH
- 2.2) RPUSH
- 2.3) LPOP
- 2.4) RPOP
- 2.5) LLEN
- 2.5) LRANGE
- 3. SETS:
- 3.1) “sadd” command:
- 3.2) “smembers” command:
- 3.3) “scard” command:
- 3.4) “sismember” command:
- 3.5) “sdiff” command:
- 3.6) “sdiffstore” command:
- 3.7) “sinter” command:
- 3.8) “sinterstore” command:
- 3.9) “sunion” command:
- 3.10) “sunionstore” command:
- 3.11) “srem” command:
- 4. HASHES:
- 4.1) HSET (Hash Set):
- 4.2) HGET (Hash Get):
- 4.3) HDEL (Hash Delete):
- 4.4) HGETALL (Hash Get All):
- 4.5) HKEYS (Hash Keys):
- 4.6) HVALS (Hash Values):
- 5. PUB/SUB:
- 5.1) PUBLISH
- 5.2) SUBSCRIBE
- 5.3) UNSUBSCRIBE
- 6. OTHER COMMANDS:
- 6.1) SELECT
- 6.2) FLUSHDB
- 6.3) SAVE
- 6.4) BGSAVE
Contact Us