mutexmaps can be easily and thread safety for Golang's map.
more information this godoc.
package main
import (
"fmt"
"github.com/seka/mutexmaps/mutexmap"
"github.com/seka/mutexmaps/mutexmultimap"
)
func main() {
m := mutexmap.New(10)
m.Put("key", "value")
item := m.Get("key")
fmt.Println(item) // "value"
m := New(1)
m.Put("a", "value1")
m.Put("a", "value2")
values := m.Get("a")
fmt.Println(item) // []interface{}{"value1", "value2"}
}
The MIT License (MIT)
Copyright (c) 2016 shin sekaryo