()
| 5 | ) |
| 6 | |
| 7 | func Cache() func(c *gin.Context) { |
| 8 | return func(c *gin.Context) { |
| 9 | if c.Request.RequestURI == "/" { |
| 10 | c.Header("Cache-Control", "no-cache") |
| 11 | } else { |
| 12 | c.Header("Cache-Control", "max-age=604800") // one week |
| 13 | } |
| 14 | c.Next() |
| 15 | } |
| 16 | } |