Redis: Sets Cheat Sheet

Sadd Command

redis 127.0.0.1:6379> SADD KEY_NAME VALUE1..VALUEN

Scard Command

redis 127.0.0.1:6379> SCARD KEY_NAME

Sdiff Command

redis 127.0.0.1:6379> SDIFF FIRST_KEY OTHER_KEY1..OTHER_KEYN

Sdiffstore Command

redis 127.0.0.1:6379> SDIFFSTORE DESTINATION_KEY KEY1..KEYN 

Sinter Command

redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN

Sinterstore Command

redis 127.0.0.1:6379> SINTERSTORE DESTINATION_KEY KEY KEY1..KEYN

Sismember Command

redis 127.0.0.1:6379> SISMEMBER KEY VALUE

Smove Command

redis 127.0.0.1:6379> SMOVE SOURCE DESTINATION MEMBER

Spop Command

redis 127.0.0.1:6379> SPOP KEY

Srandmember Command

redis 127.0.0.1:6379> SRANDMEMBER KEY [count] 

Srem Command

redis 127.0.0.1:6379> SREM KEY MEMBER1..MEMBERN

Sunion Command

redis 127.0.0.1:6379> SUNION KEY KEY1..KEYN

Sunionstore Command

redis 127.0.0.1:6379> SUNIONSTORE DESTINATION KEY KEY1..KEYN

Sscan Command

redis 127.0.0.1:6379> SSCAN KEY [MATCH pattern] [COUNT count]

Leave a Reply

Your email address will not be published.