Redis Sets Datatype and Commands

Get any of the courses at very special price. Offer is available only for limited time, so enroll quickly.

Apache NiFi – Beginners to Advance Guide: https://itpanther.com/apachenifi
Apache NiFi – Admin Guide – Know Clustering and Other Advance Topics: https://itpanther.com/apachenifiadmin
Liferay – Create Your Website Without The Need to Code: https://itpanther.com/liferay
Grafana – Learn to do Analytics with Grafana: https://itpanther.com/grafana
Redis – Learn World’s Fastest Database: https://itpanther.com/redis
BMC Control-M for Beginners: https://itpanther.com/controlm

Redis SADD – Creating and Adding Members to Redis Sets.

sadd users_ip 10.0.0.1
sadd users_ip 10.0.0.2 10.0.0.3 192.168.0

Redis SCARD – Checking total numbers of members available in a list also known as checking cardinality.

scard users_ip

Redis SMEMBERS – Checking Total Numbers of Members in a set:

smembers users_ip

Redis SDIFF – Checking Members which are available in key-set but not available in other key-set

sadd yesterday_ip 10.0.0.1 192.168.0 10.3.4.0 192..168.10.3
smembers yesterday_ip
sdiff users_ip yesterday_ip
sdiff yesterday_ip users_ip

Redis SISMEMBER – Checking If a members exist in a key-set or not?

sismember yesterday_ip 192.168.0
sismember yesterday_ip 0.0.0.0
smove yesterday_ip previous_ip 192.168.0

Redis SMOVE – Moving members from one key-set to another key-set (if destination key does not exist, it will get created automatically)

smembers previous_ip
smove yesterday_ip previous_ip 192..168.10.3
smembers previous_ip

Redis SPOP – Command to randmoly remove member of the key-set

clear
sadd users john martin rahul vikas henry
smembers sadd
smembers users
spop users
smembers users
spop users 2
smembers users
sadd users john martin rahul vikas henry
smembers users

Redis SREM – Command to remove a specific member from the keyset

srem users "john"
smembers users
srem users "vikas" "henry"
smembers users

Get any of the courses at very special price. Offer is available only for limited time, so enroll quickly.

Apache NiFi – Beginners to Advance Guide: https://itpanther.com/apachenifi
Apache NiFi – Admin Guide – Know Clustering and Other Advance Topics: https://itpanther.com/apachenifiadmin
Liferay – Create Your Website Without The Need to Code: https://itpanther.com/liferay
Grafana – Learn to do Analytics with Grafana: https://itpanther.com/grafana
Redis – Learn World’s Fastest Database: https://itpanther.com/redis
BMC Control-M for Beginners: https://itpanther.com/controlm

Leave a Comment

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

IT Panther will use the information you provide on this form to be in touch with you and to provide updates and marketing.
%d bloggers like this: