Chapter 13
These are the solutions to the Exercises.
-
You can store all usernames inside an in-memory Bloom filter. Then, each time a user asks if a particular username is available, your app would check for its existence inside the Bloom filter. Bloom filter lookups have the potential to be a lot faster than database lookups.
Because a Bloom filter never produces a false negative, it can be trusted to say if a given username is available. (That is, it doesn’t exist within the Bloom filter.) Accordingly, we never have to worry that we’ll inadvertently allow two users to end up with the same username.
At the same time, a Bloom filter can produce false positives, which means that it’s possible that the Bloom filter may tell us that a username ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access