O'Reilly logo

Mastering Redis by Jeremy Nelson

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

Bitstrings and bit operations

Specialized uses of Redis strings with the corresponding commands allow for the use of memory-efficient data structures in Redis for a comparatively small number of bits, and depending on your use case and data, using sets or hashes would offer better performance. In bitstrings, 8 bits are stored per byte, with the first bit at position 0 being the significant one that is set to either 0 or 1. The maximum size for Redis bitstrings is 512 MB, the same limitation for all Redis keys and values.

Bitstrings and bit operations

One reason that makes a bitstring so efficient and fast is that most of its commands are the O(1) or O(n) operations. With SETBIT ...

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