28
loading...
This website collects cookies to deliver better user experience
XADD twitt_feeds * date 01-07-21 username Gealber
twitt_feeds
is the name of the stream, the other incoming character *
, well this is a way to say to Redis that you don't want to specify an ID of the data by yourself, instead you are requesting to the server to assign this ID for you. And the last part date 01-07-21 username Gealber
, represents the actual data that you want to store, this data comes in pairs, the first part in this case is the date 01-07-21
, and the other one is username Gealber
.<millisecondsTime>-<sequenceNumber>
XRANGE twitt_feeds - +
-
and +
, does these characters have a special meaning? Well in this particular case you are saying, "give me the data from the first data in the stream to the last one", so basically you are requesting all the data.XRANGE twitt_feeds + - COUNT 3
<millisecondsTime>-<sequenceNumber>
. You could request elements in a range of time, for exampleXRANGE twitt_feeds 1625161017441 1625162015154
1625161017441
and 1625162015154
. In a real application this is pretty useful, you could request info that happened in a range of time.XLEN twitt_feeds
28