File size: 537 Bytes
ca7217f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package route

import (
	"time"

	"github.com/gin-gonic/gin"
	cachecontrol "go.eigsys.de/gin-cachecontrol/v2"
)

func cachePublicSMaxAge(duration time.Duration) gin.HandlerFunc {
	return cachecontrol.New(cachecontrol.Config{
		Public:  true,
		SMaxAge: cachecontrol.Duration(duration),
	})
}

func cacheNoStore() gin.HandlerFunc {
	return cachecontrol.New(cachecontrol.Config{
		// The no-store response directive indicates that any
		// caches of any kind (private or shared) should not
		// store this response.
		NoStore: true,
	})
}