cache
Package cache is a middleware that provides the cache management for Flamego.
Installation
The minimum requirement of Go is 1.16.
go get github.com/flamego/cache
Getting started
package main
import (
"time"
"github.com/flamego/cache"
"github.com/flamego/flamego"
)
func main() {
f := flamego.Classic()
f.Use(cache.Cacher())
f.Get("/", func(cache cache.Cache) {
_ = cache.Set("cooldown", true, time.Minute)
cooldown, ok := cache.Get("cooldown").(bool)
// ...
})
f.Run()
}
License
This project is under the MIT License. See the LICENSE file for the full license text.