Concurrent-map is a lock-striped hash map and sharded concurrent cache for Go, designed as a high-performance key-value store that enables thread-safe parallel reads and writes with minimal blocking. It replaces a single global mutex with per-shard locking, using hash-based key distribution to assign entries to independent segments, allowing multiple goroutines to operate simultaneously without race conditions.
The library achieves its performance through fine-grained locking and a lock-free read path, where each shard operates independently with its own lock, enabling parallel reads and writes across different shards without interference. It supports snapshot-based iteration, allowing safe traversal of all entries while concurrent modifications occur, and provides standard key-value operations including insertion, retrieval, deletion, existence checks, counting, and clearing all entries in a thread-safe manner.
As a sharded in-memory cache, concurrent-map partitions data into independent segments to reduce lock contention and maximize throughput for concurrent access patterns. The project is distributed as a Go package with a straightforward API for storing and retrieving key-value pairs across multiple goroutines.