How to acquire a lock by a key

前端 未结 6 1376
一个人的身影
一个人的身影 2020-11-28 09:47

What is the best way to prevent concurrent update of one record in a key-value set without locking the entire set? Semantically, I\'m looking for some kind of locking by a k

6条回答
  •  甜味超标
    2020-11-28 10:17

    Keep a mutex/lock per bucket. This will ensure that only collisions wait on that mutex.

提交回复
热议问题