Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Redis

You're reading from   Mastering Redis Take your knowledge of Redis to the next level to build enthralling applications with ease

Arrow left icon
Product type Paperback
Published in May 2016
Publisher Packt
ISBN-13 9781783988181
Length 366 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Vidyasagar N V Vidyasagar N V
Author Profile Icon Vidyasagar N V
Vidyasagar N V
 Nelson Nelson
Author Profile Icon Nelson
Nelson
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Mastering Redis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Why Redis? FREE CHAPTER 2. Advanced Key Management and Data Structures 3. Managing RAM – Tips and Techniques for Redis Memory Management 4. Programming Redis Part One – Redis Core, Clients, and Languages 5. Programming Redis Part Two – Lua Scripting, Administration, and DevOps 6. Scaling with Redis Cluster and Sentinel 7. Redis and Complementary NoSQL Technologies 8. Docker Containers and Cloud Deployments 9. Task Management and Messaging Queuing 10. Measuring and Managing Information Streams Sources Index

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.

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 and GETBIT, bits are either set to 0 or 1 or the value retrieved by both O(1) operations and the use of a bitstring to store the binary information across a range of sequential values is extremely fast. For the BITOP, BITPOS, and BITCOUNT commands, the time complexity is O(n) but offers power semantics for using bitstrings.

A common use case for...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images