- Notifications
You must be signed in to change notification settings - Fork0
Cache-Control middleware for Gin
License
NotificationsYou must be signed in to change notification settings
joeig/gin-cachecontrol
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This Gin middleware generates cache-control headers.
go get -u go.eigsys.de/gin-cachecontrol/v2
import"go.eigsys.de/gin-cachecontrol/v2"
// Apply globally:r.Use(cachecontrol.New(cachecontrol.NoCachePreset))// Apply to specific routes:cacheForever:=cachecontrol.New(cachecontrol.CacheAssetsForeverPreset)r.GET("/favicon.ico",cacheForever,faviconHandler)
Supported presets (documentation):
cachecontrol.NoCachePresetcachecontrol.CacheAssetsForeverPreset(you may only want this for carefully selected routes)
r.Use(cachecontrol.New( cachecontrol.Config{MustRevalidate:true,NoCache:false,NoStore:false,NoTransform:false,Public:true,Private:false,ProxyRevalidate:true,MaxAge:cachecontrol.Duration(30*time.Minute),SMaxAge:nil,Immutable:false,StaleWhileRevalidate:cachecontrol.Duration(2*time.Hour),StaleIfError:cachecontrol.Duration(2*time.Hour), } ))
SeeGo reference.
About
Cache-Control middleware for Gin
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.