Tech News
← Back to articles

Cmapv2: A high performance, concurrent map

read original related products more articles

cmapv2

installation

In your Go project main directory (where the go.mod file is located)

go get github.com/sirgallo/cmapv2 go mod tidy

Make sure to run go mod tidy to install dependencies.

usage

package main import ( "github.com/sirgallo/cmapv2" ) func main () { // initialize c map cMap := cmap . NewMap () // insert key/val pair cMap . Put ([] byte ( "hi" ), [] byte ( "world" )) // retrieve value for key val := cMap . Get ([] byte ( "hi" )) // delete key/val pair cMap . Delete ([] byte ( "hi" )) // ===== OR // initialize sharded c map with number of shards sMap := cmap . NewMap ( 16 ) sMap . Put ([] byte ( "hi" ), [] byte ( "world" )) val := sMap . Get ([] byte ( "hi" )) sMap . Delete ([] byte ( "hi" )) }

tests

go test -v ./tests

or bench:

... continue reading