Complete the code to add an element to the end of a Redis list.
redis-cli RPUSH mylist [1]RPUSH adds the specified element to the end of the list named 'mylist'.
Complete the code to add an element with a score to a Redis sorted set.
redis-cli ZADD myzset [1] elementZADD requires the sorted set name, a score, and the element to add. The score determines the order.
Fix the error in the command to get the first 3 elements from a Redis list.
redis-cli LRANGE mylist [1] 2
LRANGE uses zero-based indexes. To get the first 3 elements, start at 0 and end at 2.
Fill both blanks to retrieve elements with scores between 10 and 20 from a sorted set.
redis-cli ZRANGEBYSCORE myzset [1] [2]
ZRANGEBYSCORE returns elements with scores between the given min and max values, inclusive.
Fill all three blanks to add an element with score 15 and then retrieve elements with scores between 10 and 20.
redis-cli [1] myzset [2] element && redis-cli ZRANGEBYSCORE myzset 10 20
First, use ZADD to add 'element' with score 15 to 'myzset'. Then use ZRANGEBYSCORE to get elements with scores between 10 and 20.