Complete the code to add a visitor ID to the set of unique visitors for today.
SADD unique_visitors:2024-06-01 [1]
The SADD command adds a member to a set. Here, we add the visitor ID visitor123 to the set unique_visitors:2024-06-01.
Complete the code to count how many unique visitors visited today.
SCARD [1]The SCARD command returns the number of members in a set. We use the key unique_visitors:2024-06-01 to count today's unique visitors.
Fix the error in the code to get the union of unique visitors from two days.
SUNION unique_visitors:2024-06-01 [1]
The SUNION command returns the union of sets. To get visitors from two days, use the keys for those days. Here, we fix the second key to unique_visitors:2024-06-02.
Fill both blanks to store the union of two days' unique visitors into a new set.
SUNIONSTORE [1] unique_visitors:2024-06-01 [2]
SUNIONSTORE saves the union of sets into a new key. We store the union of unique_visitors:2024-06-01 and unique_visitors:2024-06-02 into unique_visitors:2024-06-01-02.
Fill all three blanks to find the intersection of three days' unique visitors and store it in a new set.
SINTERSTORE [1] unique_visitors:2024-06-01 [2] [3]
SINTERSTORE stores the intersection of sets into a new key. Here, we find visitors common to June 1, 2, and 3, and store them in unique_visitors:2024-06-01-02-03.