Go package for dealing with caching. Maybe not so fast.
Requires Go 1.9+ since the package is using type aliases.
$ go get -u github.com/frozzare/go-cache
- Memory
- Redis
- Bolt
More cache stores can be implemented by using the provided store interface.
package main
import (
"log"
"github.com/frozzare/go-cache"
"github.com/frozzare/go-cache/store/redis"
)
func main() {
c := cache.New(redis.NewStore(&redis.Options{
Addr: "localhost:6379",
}))
if err := c.Set("name", "go"); err != nil {
log.Fatal(err)
}
v, err := c.Get("name")
if err != nil {
log.Fatal(err)
}
log.Println(v)
}
MIT © Fredrik Forsmo