Data structures

Redis has a wealth of data structures, but not maps. Here is a non-exhaustive list of the data structures:

  • Lists: Essentially a linked lists of string elements with elements in the order of insertion (first in, first out).
  • Sets: Collections of unique, unsorted string elements.
  • Sorted sets: A data structure similar to sets, but where every string element is associated with a score—which is a floating number. The elements inside the sorted set can be accessed (iterator) in order of the score. This allows use cases of leader board, such as "Top-10 performing hotels."
  • Hashes: These are maps with an additional level of fields and associated values. This allows a partial update of the value (just a field) and efficient retrieval (all the fields of the hash).
  • Bitmap: Bit arrays with constructs to set/clear individual bits, count all bits set to 1, find the first set bit, and so on.
  • HyperLogLogs: HyperLogLog is a probabilistic data structure that can efficiently estimate the cardinality of a set. We will look at probabilistic data structures in detail later in the chapter.
  • Pub/sub: This construct allows clients to send (publish) messages to an abstract channel and other clients (subscribers) to consume messages from the channels. Details of this paradigm are captured in Chapter 6, Messaging. It should be noted that there is no storage of messages—only those subscribers who are currently listening get published messages.

For more details, refer to https://redis.io/commands.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset