Concurrent Map

a thread-safe concurrent map for go
Alternatives To Concurrent Map
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Concurrentqueue7,886
3 months ago31otherC++
A fast multi-producer, multi-consumer lock-free concurrent queue for C++11
Crossbeam6,3311,4761,14810 days ago35April 09, 2023123apache-2.0Rust
Tools for concurrent programming in Rust
Concurrent Ruby5,52811125 days ago69February 24, 202350otherRuby
Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
Concurrent Map3,86383319a month ago4November 08, 202230mitGo
a thread-safe concurrent map for go
Golang Set3,4835032,3115 days ago9August 02, 20236otherGo
A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.
Concurrencpp1,692
5 days ago7mitC++
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Greenlet1,5139,89050410 days ago45September 01, 202317otherC++
Lightweight in-process concurrent programming
Pypeln1,412564 months ago36January 06, 202222mitPython
Concurrent data pipelines in Python >>>
Java Study1,119
3 months ago12apache-2.0Java
java-study 是本人学习Java过程中记录的一些代码!从Java基础的数据类型、jdk1.8的Lambda、Stream和日期的使用、 IO流、数据集合、多线程使用、并发编程、23种设计模式示例代码、常用的工具类, 以及一些常用框架,netty、mina、springboot、kafka、storm、zookeeper、redis、elasticsearch、hbase、hive等等。
Java Concurrency748
3 years ago10
Checklist for code reviews
Alternatives To Concurrent Map
Select To Compare


Alternative Project Comparisons
Readme

concurrent map Build Status

As explained here and here, the map type in Go doesn't support concurrent reads and writes. concurrent-map provides a high-performance solution to this by sharding the map with minimal time spent waiting for locks.

Prior to Go 1.9, there was no concurrent map implementation in the stdlib. In Go 1.9, sync.Map was introduced. The new sync.Map has a few key differences from this map. The stdlib sync.Map is designed for append-only scenarios. So if you want to use the map for something more like in-memory db, you might benefit from using our version. You can read more about it in the golang repo, for example here and here

usage

Import the package:

import (
	"github.com/orcaman/concurrent-map/v2"
)

go get "github.com/orcaman/concurrent-map/v2"

The package is now imported under the "cmap" namespace.

example


	// Create a new map.
	m := cmap.New[string]()

	// Sets item within map, sets "bar" under key "foo"
	m.Set("foo", "bar")

	// Retrieve item from map.
	bar, ok := m.Get("foo")

	// Removes item under key "foo"
	m.Remove("foo")

For more examples have a look at concurrent_map_test.go.

Running tests:

go test "github.com/orcaman/concurrent-map/v2"

guidelines for contributing

Contributions are highly welcome. In order for a contribution to be merged, please follow these guidelines:

  • Open an issue and describe what you are after (fixing a bug, adding an enhancement, etc.).
  • According to the core team's feedback on the above mentioned issue, submit a pull request, describing the changes and linking to the issue.
  • New code must have test coverage.
  • If the code is about performance issues, you must include benchmarks in the process (either in the issue or in the PR).
  • In general, we would like to keep concurrent-map as simple as possible and as similar to the native map. Please keep this in mind when opening issues.

language

license

MIT (see LICENSE file)

Popular Concurrent Projects
Popular Thread Projects
Popular Control Flow Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Go
Golang
Thread
Stdlib
Concurrency
Concurrent
Sharding
Concurrent Programming