/go-mmap

:package: Concurrent-safe map[interface{}]interface{}

Primary LanguageGoThe UnlicenseUnlicense

mmap

Build Status GoDoc

Package mmap implements a concurrent-safe map.

Simply the basic operations on maps but guarded with RWMutex.

Example

package main

import (
    "fmt"
    "github.com/dawidd6/go-mmap"
)

func main() {
    m := mmap.New()

    m.Set("key", "value")

    fmt.Println(m.Has("key")) // true
    fmt.Println(m.Get("key")) // value
    fmt.Println(m.Count()) // 1
    fmt.Println(m.Items()) // [value]

    m.Iterate(func(key interface{}, value interface{}) {
        fmt.Println(key, value) // key value
    })

    m.Remove("key")
}