ConcurrentMap
thread-safe map
Install / Use
/learn @xiao7737/ConcurrentMapREADME
concurrentMap
Features
- thread safe and high performance read and write
- sharding mechanism to reduce lock range
- read-write lock to improve concurrency
- murmurHash to make the distribution more reasonable
- support user program to customize the number of shard
- provide operations including create, get, set, del, count, exists
Import
go get "github.com/xiao7737/concurrentMap"
Usage
// Init map (recommend to take an alias)
cm := concurrentMap.CreateConcurrentMap(32)
// Add or update
cm.Set(ConvertStr("hello"), "go")
// Get kv
res, ok := cm.Get(ConvertStr("hello"))
// Del kv
cm.Del(ConvertStr("hello"))
Performance comparison with sync.Map

TODO
- Batch setting operation
More details
- See more details through test file: concurrent_map_test.go
- Get performance comparison:
go test -bench=.
Related Skills
node-connect
347.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
347.6kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
108.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
