Files
photoprism/internal/api/cache.go
2021-01-07 22:55:50 +01:00

20 lines
350 B
Go

package api
import (
"fmt"
"github.com/gin-gonic/gin"
)
type MaxAge string
var (
CacheShort MaxAge = "3600"
CacheLong MaxAge = "86400"
)
// AddCacheHeader adds a cache control header to the response.
func AddCacheHeader(c *gin.Context, maxAge MaxAge) {
c.Header("Cache-Control", fmt.Sprintf("private, max-age=%s, no-transform", maxAge))
}