Delete removes a key from the map if it exists. Returns nothing.
(key string)
| 96 | |
| 97 | // Delete removes a key from the map if it exists. Returns nothing. |
| 98 | func (m *lockingMap) Delete(key string) { |
| 99 | m.keyLocker.Lock(key) |
| 100 | defer m.keyLocker.Unlock(key) |
| 101 | |
| 102 | m.lock.Lock() |
| 103 | defer m.lock.Unlock() |
| 104 | |
| 105 | delete(m.data, key) |
| 106 | } |
| 107 | |
| 108 | // AddOrGet returns the current value. You must pass in a LockingMapAddFunc |
| 109 | // as the second parameter: if the key you are requesting is not present in the |