// Synchronize map access between multiple goroutines. type cache struct { m map[string]string sync.RWMutex }
Then, you can just use:
cache.Lock/Unlock/RLock/RUnlock directly. It's clearer. The beauty of Go's mixins.
// Synchronize map access between multiple goroutines. type cache struct { m map[string]string sync.RWMutex }
Then, you can just use:
cache.Lock/Unlock/RLock/RUnlock directly. It's clearer. The beauty of Go's mixins.