MemoryDB Golang , +Batch
Switch branches/tags
Nothing to show
Clone or download
Latest commit 92bb049 Oct 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
memdb hello Oct 11, 2018
README.md blablabla Oct 11, 2018
main.go hello Oct 11, 2018

README.md

MemoryDB


Interfaces

  • NewMemDB
  • NewMemDBWithCap
  • Put
  • Get
  • Has
  • Keys
  • Delete
  • Batch -- Put -- Delete

Installation

Just use go get.

    go get github.com/AmirSoleimani/MemoryDB/memdb

Sample

func main() {
    	// sample
    	memDB := db.NewMemDB()
    	memDB.Put([]byte("blabla"), []byte("gogogo"))
    
    	a, _ := memDB.Get([]byte("blabla"))
    	fmt.Println(string(a))
    
    	batch := memDB.NewBatch()
    	batch.Put([]byte("1111"), []byte("aaaaaa"))
    	batch.Put([]byte("2222"), []byte("bbbbb"))
    	batch.Delete([]byte("blabla"))
    	batch.Write()
    
    	fmt.Println(memDB.Keys())
}