Tutorial by Examples

The size of a set can be determined using the SCARD command. SCARD will return the cardinality of a set or the number of members in the set. For example, if I had a Redis set my_set stored in the database that looked like (Apple, Orange, Banana), I could get the size using the following code: SCA...
The basic Redis command for adding an item to a set is SADD. It takes a key and one or more members and adds them to the set stored at the given key. For example, lets say that I wanted to create a set with the items apple, pear and banana. I could execute either of the following: SADD fruit app...
Redis supplies the SISMEMBER command to test if a particular item is already a member of a set. Using the SISMEMBER command I can test and see if apple is already a member of my fruit set. If I construct my fruit set from the previous example, I can check and see if it contains apple using the fol...

Page 1 of 1