Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lyrictian/cmap
A thread-safe map for the Go programming language.
https://github.com/lyrictian/cmap
concurrency-map go-map
Last synced: about 2 months ago
JSON representation
A thread-safe map for the Go programming language.
- Host: GitHub
- URL: https://github.com/lyrictian/cmap
- Owner: LyricTian
- License: mit
- Created: 2018-11-07T07:17:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T07:17:43.000Z (about 6 years ago)
- Last Synced: 2024-10-16T19:57:19.528Z (2 months ago)
- Topics: concurrency-map, go-map
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Concurrent Map
> A thread-safe map for the Go programming language.
[![License][License-Image]][License-Url] [![ReportCard][ReportCard-Image]][ReportCard-Url] [![GoDoc][GoDoc-Image]][GoDoc-Url]
## Install
``` bash
$ go get -u github.com/LyricTian/cmap
```## Usage
``` go
package mainimport (
"fmt""github.com/LyricTian/cmap"
)func main() {
m := cmap.NewShardMap()
// or
// m := cmap.NewMap()
m.Set("foo", "bar")
if v, ok := m.Get("foo"); ok {
fmt.Println("foo=", v.(string))
}
m.Remove("foo")
}
```## Benchmark
```
BenchmarkMapSet-8 1000000 1032 ns/op
BenchmarkParallelMapSet-8 1000000 1217 ns/op
BenchmarkShardMapSet-8 2000000 854 ns/op
BenchmarkParallelShardMapSet-8 5000000 395 ns/op
```## MIT License
```
Copyright (c) 2016 Lyric
```[License-Url]: http://opensource.org/licenses/MIT
[License-Image]: https://img.shields.io/npm/l/express.svg
[ReportCard-Url]: https://goreportcard.com/report/github.com/LyricTian/cmap
[ReportCard-Image]: https://goreportcard.com/badge/github.com/LyricTian/cmap
[GoDoc-Url]: https://godoc.org/github.com/LyricTian/cmap
[GoDoc-Image]: https://godoc.org/github.com/LyricTian/cmap?status.svg