go get github.com/baxiry/kv
package main
import (
"github.com/baxiry/kv"
)
func main() {
imap := new(kv.Map[int, int])
imap.Set(1, 111) // insert
imap.Set(1, 123) // update
imap.Set(2, 222)
val, ok := imap.Get(1) // 123 , treu
val, ok = imap.Get(10) // 0, false (key not exist)
ok := imap.HasKey(2) // true
ok = imap.HasKey(20) // false
imap.Delete(2)
ok = imap.HasKey(2) // false
// new stringer Map
strMap := new(kv.Map[string, string])
strMap.Set("hi", "hello")
}
- Set
- Get
- HasKey
- Delete
- full testing.
- auto delete by timeout.
- benchmark.
- avoid pointers as mach as posible for more gc effecion.
use it with any license you prefer