Redis › Strings & Bitmaps in Redis
How would you use bitmap operations like BITOP to combine multiple daily activity bitmaps and answer questions like how many users were active on both of two specific days?
AdvancedAnswer
You use BITOP with the AND operation to combine two bitmaps into a new one where only bits set in both original bitmaps remain set, and then run BITCOUNT on that resulting combined bitmap to get the count of users active on both days, giving you powerful analytical capabilities using very simple, efficient bitwise operations.
BITOP AND result_key user_active:2026-09-06 user_active:2026-09-07
BITCOUNT result_keyReal-world example A product analytics team calculates how many users were active on both Saturday and Sunday by combining the two days' bitmaps with a bitwise AND operation, then counting the resulting set bits, all using extremely memory efficient bitmap operations.