diff options
| author | Christine Dodrill <me@christine.website> | 2018-10-05 10:06:54 -0700 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-10-05 14:31:22 -0700 |
| commit | dbeba1e5c5c0bc534a515eb298ee4f1d49df4d20 (patch) | |
| tree | 2bbca457936bbf32290b9a8543f9a2f156b45175 /vendor/github.com/streamrail/concurrent-map/README.md | |
| parent | 7332b16d4a09492e5a35ad00d3ab58ac5742cad6 (diff) | |
| download | x-dbeba1e5c5c0bc534a515eb298ee4f1d49df4d20.tar.xz x-dbeba1e5c5c0bc534a515eb298ee4f1d49df4d20.zip | |
update vendor
Diffstat (limited to 'vendor/github.com/streamrail/concurrent-map/README.md')
| -rw-r--r-- | vendor/github.com/streamrail/concurrent-map/README.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/github.com/streamrail/concurrent-map/README.md b/vendor/github.com/streamrail/concurrent-map/README.md new file mode 100644 index 0000000..e6b4839 --- /dev/null +++ b/vendor/github.com/streamrail/concurrent-map/README.md @@ -0,0 +1,53 @@ +# concurrent map [](https://circleci.com/gh/streamrail/concurrent-map) + +As explained [here](http://golang.org/doc/faq#atomic_maps) and [here](http://blog.golang.org/go-maps-in-action), 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. + +## usage + +Import the package: + +```go +import ( + "github.com/streamrail/concurrent-map" +) + +``` + +```bash +go get "github.com/streamrail/concurrent-map" +``` + +The package is now imported under the "cmap" namespace. + +## example + +```go + + // Create a new map. + map := cmap.New() + + // Sets item within map, sets "bar" under key "foo" + map.Set("foo", "bar") + + // Retrieve item from map. + if tmp, ok := map.Get("foo"); ok { + bar := tmp.(string) + } + + // Removes item under key "foo" + map.Remove("foo") + +``` + +For more examples have a look at concurrent_map_test.go. + + +Running tests: + +```bash +go test "github.com/streamrail/concurrent-map" +``` + + +## license +MIT (see [LICENSE](https://github.com/streamrail/concurrent-map/blob/master/LICENSE) file) |
