The most important Redis data structures you must understand

Jerry An
Analytics Vidhya
Published in
5 min readDec 18, 2020

--

redis data structures

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

Redis is the world’s most popular in-memory data structure server. In order to make good use of it, we need to understand its basic data structures first.

Strings

The Redis String type is the simplest type of value you can associate with a Redis key. It is also the base type of the complex types, because a List is a list of strings, a Set is a set of strings, and so forth.

The time complexity of all commands above is O(1).

Note that Redis stores everything in its string representation. Even functions like INCR work by first parsing it into INTEGER then performing the operation.

Lists

From a very general point of view, a List is just a sequence of ordered elements: 10,20,1,2,3 is a list. But the properties of a…

--

--