Bitmaps

A Bitmap is not a real data type in Redis. Under the hood, a Bitmap is a String. We can also say that a Bitmap is a set of bit operations on a String. However, we are going to consider them as data types because Redis provides commands to manipulate Strings as Bitmaps. Bitmaps are also known as bit arrays or bitsets.

A Bitmap is a sequence of bits where each bit can store 0 or 1. You can think of a Bitmap as an array of ones and zeroes. The Redis documentation refers to Bitmap indices as offsets. The application domain dictates what each Bitmap index means.

Bitmaps are memory efficient, support fast data lookups, and can store up to 232 bits (more than 4 billion bits).

See this example of a Bitmap with three bits turned on and two turned ...

Get Redis Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.