-
I'm a bit confused by the second snippet for the sharded DB. Where does the let shard = db[hash(key) % db.len()].lock().unwrap();
shard.insert(key, value); |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Apr 26, 2024
Replies: 1 comment 1 reply
-
You'll have to choose a hash function that is appropriate for whatever the type of |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Lun4m
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll have to choose a hash function that is appropriate for whatever the type of
key
is. There are many different hash functions out there, and the example will work for whichever choice you make.