feat: add disable cache middleware

This commit is contained in:
creamlike1024
2025-08-27 01:30:01 +08:00
parent 1555e6832e
commit d6fcc7a51d
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
package middleware
import "github.com/gin-gonic/gin"
func DisableCache() gin.HandlerFunc {
return func(c *gin.Context) {
c.Header("Cache-Control", "no-store, no-cache, must-revalidate, private, max-age=0")
c.Header("Pragma", "no-cache")
c.Header("Expires", "0")
c.Next()
}
}