Join us for RedisConf and Hackathon, April 20-21
As we mentioned earlier, whereas user profiles store information about an individual,
the ideas that people are trying to express are stored in status messages. As was the
case with user information, we’ll store status message information inside a HASH.
In addition to the message itself, we’ll store when the status message was posted, the user ID and login of the user who posted it (so that if we have a status object, we don’t need to fetch the user object of the poster to discover their login name), and any additional information that should be stored about the status message. Figure 8.2 shows an example status message.
And that’s everything necessary for a basic status message. The code to create such a status message can be seen in the next listing.
There isn’t anything surprising going on in the status creation function. The function
fetches the login name of the user, gets a new ID for the status message, and then combines
everything together and stores it as a HASH.
We’ll talk about making the status message visible to followers in section 8.4, so sit
tight for now, as we now examine the most commonly used view into lists of status messages:
a user’s home timeline.
TRY REDIS ENTERPRISE CLOUD FREE
Redis Enterprise Cloud provides complete automation of day-to-day database operations. Start now with 30MB of free storage.
© 2021 Redis Labs. Redis and the cube logo are registered trademarks of Redis Labs Ltd.