RWMutex protects shared state when reads outnumber writes: multiple goroutines may read concurrently, while a write obtains exclusive access. This limits race conditions without serializing every read. section 8.2.4
Protecting an in-memory map
Embed sync.RWMutex beside the shared map. A write calls Lock and defers Unlock; a read calls RLock and defers RUnlock. The Shortener can then safely serve concurrent Resolve calls while serializing Shorten operations.



