Complete the code to add a new entry to the stream with an auto-generated ID.
XADD mystream [1] name "Alice" age 30
Using * tells Redis to auto-generate the stream entry ID.
Complete the code to read entries from the stream starting from the given ID.
XRANGE mystream [1] +The ID 0-0 means start reading from the very first entry in the stream.
Fix the error in the code to add an entry with a specific ID.
XADD mystream [1] name "Bob" age 25
To add an entry with a specific ID, use the exact ID like 1-0. Using * auto-generates the ID.
Fill both blanks to trim the stream to a maximum length and add a new entry with auto ID.
XADD mystream [1] [2] 10 * name "Carol" age 28
MAXLEN trims the stream to a max length, and ~ makes the trimming approximate for better performance.
Fill both blanks to read entries from the stream starting after a given ID and limiting the count.
XREAD COUNT [1] STREAMS mystream [2]
COUNT 10 limits the number of entries returned, and > reads only new entries added after the last ID.