in

A middleware that provides the cache management for Flamego


Codecov GoDoc Sourcegraph

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.

GitHub

https://github.com/flamego/cache




Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

GIPHY App Key not set. Please check settings

SOULMATE LYRICS – Akull, Aastha Gill

TERI AKHEEYAN LYRICS – Qismat 2 | Ammy Virk