Complete the code to get the number of elements in the set named 'myset'.
SCARD [1]The SCARD command returns the number of elements in the specified set. Here, the set is named myset.
Complete the code to find the size of the set stored in the variable 'setKey'.
SCARD [1]Redis commands are case-sensitive for keys. Use the exact variable name setKey as the set name.
Fix the error in the command to get the set size of 'users'.
SCARD [1]The set name is users. Using user or other variants will cause Redis to look for a different key.
Fill both blanks to get the size of the set named 'activeUsers' and store it in variable 'count'.
count = [1]([2]) activeUsers
get which is for strings, not sets.SET which is for setting values, not getting size.In Redis scripting, redis.call is used to run commands like SCARD to get the size of a set.
Fill all three blanks to write a Lua script that returns the size of the set given by the first key argument.
return [1]([2], [3][1])
ARGV instead of KEYS for keys.get instead of SCARD.This Lua script calls redis.call with the command SCARD on the first key in KEYS to get the set size.