Skip to content

baxiry/kv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

key value in memory store

safe concurrent key value in memory store

install:

go get github.com/baxiry/kv 

usage:

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")
}

TODO:

  • Set
  • Get
  • HasKey
  • Delete
  • full testing.

not important

  • auto delete by timeout.
  • benchmark.
  • avoid pointers as mach as posible for more gc effecion.

license:

use it with any license you prefer

About

safe concurrent key value in memory store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages