Database / REDIS
Define a Redis Bitmap?
A Bitmap isn't a separate data type in Redis — it's a way of treating an ordinary String value as a compact array of individual bits, addressed by offset, using dedicated bit-level commands. Because a String can hold up to 512MB, a single key can represent billions of individual boolean flags extremely compactly.
SETBIT user:1001:active_days 5 1 # mark day 5 as active GETBIT user:1001:active_days 5 # check day 5 BITCOUNT user:1001:active_days # count how many bits are set
The classic use case is tracking a large number of boolean states per entity extremely cheaply — whether a user was active on each day of the year (365 bits = under 46 bytes), feature-flag membership across millions of users, or approximate presence tracking. BITCOUNT and bitwise operations like BITOP AND/OR let you answer questions like "how many users were active on both day 5 and day 6" across huge populations using a handful of fast, memory-efficient operations rather than scanning individual records.
More Related questions...
