Language: English | Русский
Manager memory key:value store/cache in Golang
go get github.com/RGRU/go-memorycache
First you must import it
import (
memorycache "github.com/RGRU/go-memorycache"
)
Init a new Cache
cache := memorycache.New("testDB", 5 * time.Minute, 10 * time.Minute)
Use it like this:
// Set cache by key
cache.Set("myKey", "My value", 5 * time.Minute)
// Get cache by key
cache.Get("myKey")
// Check exist cache
cache.Exist("myKey")
// Delete cache by key
cache.Delete("myKey")