Make sure you have a working Go environment (Go 1.18 or higher is required). See the install instructions.
To install GoCache, simply run:
go get github.com/pkg6/go-cache
package main
import (
"github.com/pkg6/go-cache"
)
func main() {
c := cache.New()
c.Extend(cache.NewFileCache())
c.Set("cache", "test", 0)
c.Get("cache")
c.GetMulti([]string{"cache"})
c.Delete("cache")
c.Has("cache")
c.Increment("cache_inc", 1)
c.Decrement("cache_dec", 1)
c.Clear()
c.Pull("cache")
c.Remember("cache", func() any {
return "test1"
}, 0)
}