Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

xiao7737/concurrentMap

Repository files navigation

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

image

TODO

  • Batch setting operation

More details

About

thread-safe map

Topics

Resources

License

Stars

Watchers

Forks

Languages

AltStyle によって変換されたページ (->オリジナル) /