O'Reilly logo

Redis Essentials by Hugo Lopes Tavares, Maxwell Dayvson Da Silva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required