Skip to content

Commit

Permalink
fix(server): update cache config
Browse files Browse the repository at this point in the history
  • Loading branch information
g0rbe committed Sep 30, 2023
1 parent fb783ce commit fc40734
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/server/history/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func GetApiHistory(c *gin.Context) {

// Cache for 10 minutes, domains are not updated this often,
// but caching saves a lot of processing power.
c.Header("cache-control", "public, max-age=600")
c.Header("cache-control", "public, max-age=600, must-revalidate, stale-if-error=604800")
c.Header("expires", time.Now().UTC().Add(600*time.Second).Format(time.RFC1123))

c.JSON(http.StatusOK, hs)
Expand Down
6 changes: 3 additions & 3 deletions server/server/lookup/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func GetApiLookup(c *gin.Context) {
}

// Cache for 10 minutes.
c.Header("cache-control", "public, max-age=600")
c.Header("cache-control", "public, max-age=600, must-revalidate, stale-if-error=604800")
c.Header("expires", time.Now().UTC().Add(600*time.Second).Format(time.RFC1123))
c.Header("vary", "Accept")

Expand Down Expand Up @@ -153,7 +153,7 @@ func GetApiTLD(c *gin.Context) {
}

// Cache for 10 minutes.
c.Header("cache-control", "public, max-age=600")
c.Header("cache-control", "public, max-age=600, must-revalidate, stale-if-error=604800")
c.Header("expires", time.Now().UTC().Add(600*time.Second).Format(time.RFC1123))
c.Header("vary", "Accept")

Expand Down Expand Up @@ -212,7 +212,7 @@ func GetApiStarts(c *gin.Context) {
}

// Cache for 10 minutes.
c.Header("cache-control", "public, max-age=600")
c.Header("cache-control", "public, max-age=600, must-revalidate, stale-if-error=604800")
c.Header("expires", time.Now().UTC().Add(600*time.Second).Format(time.RFC1123))
c.Header("vary", "Accept")

Expand Down
2 changes: 1 addition & 1 deletion server/server/statistics/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetApiStat(c *gin.Context) {
}

// Cache for 10 minutes.
c.Header("cache-control", "public, max-age=600")
c.Header("cache-control", "public, max-age=600, stale-while-revalidate=600, stale-if-error=604800")
c.Header("expires", time.Now().UTC().Add(600*time.Second).Format(time.RFC1123))

c.JSON(http.StatusOK, s)
Expand Down

0 comments on commit fc40734

Please sign in to comment.