Close stops the background cleanup worker. It's optional to call; maps live for the process lifetime in many cases. Call in tests or when you know you no longer need the map to avoid goroutine leaks.
()
| 138 | // for the process lifetime in many cases. Call in tests or when you know you no |
| 139 | // longer need the map to avoid goroutine leaks. |
| 140 | func (m *Impl[K, V]) Close() { |
| 141 | close(m.stopCh) |
| 142 | m.wg.Wait() |
| 143 | } |
| 144 | |
| 145 | // cleanupWorker batches decay deletions to minimize lock contention. |
| 146 | func (m *Impl[K, V]) cleanupWorker() { |
no outgoing calls