Archived
Template
1
0
This repository has been archived on 2023-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
Files

15 lines
276 B
Go
Raw Permalink Normal View History

package middleware
import (
"fmt"
"github.com/gin-gonic/gin"
)
// Cache middleware sets the Cache-Control header
func Cache(maxAge int) gin.HandlerFunc {
return func(c *gin.Context) {
c.Header("Cache-Control", fmt.Sprintf("public, max-age=%d", maxAge))
c.Next()
}
}