Lock locks the `key` with writing lock. If there's a write/reading lock the `key`, it will block until the lock is released.
(key string)
| 33 | // If there's a write/reading lock the `key`, |
| 34 | // it will block until the lock is released. |
| 35 | func (l *Locker) Lock(key string) { |
| 36 | l.getOrNewMutex(key).Lock() |
| 37 | } |
| 38 | |
| 39 | // TryLock tries locking the `key` with writing lock, |
| 40 | // it returns true if success, or it returns false if there's a writing/reading lock the `key`. |