Add cache context
This commit is contained in:
parent
4e769339ca
commit
797c990c45
6 changed files with 16 additions and 4 deletions
|
@ -17,9 +17,15 @@
|
|||
(defmethod jingle:process-response ((app jingle:app) result)
|
||||
(set-response-header :content-type "text/html; charset=utf-8")
|
||||
(when (eq (request-method *request*) :get)
|
||||
(set-response-header :cache-control (if (string= (website-env) "dev")
|
||||
"private, no-store"
|
||||
"public, max-age=60")))
|
||||
(set-response-header :cache-control (cond ((string= (website-env) "dev")
|
||||
"private, no-store")
|
||||
((eq (context :cache) :static)
|
||||
"public, max-age=60, s-maxage=604800")
|
||||
((eq (context :cache) :dynamic)
|
||||
"public, max-age=60")
|
||||
(t
|
||||
"private, no-store"))))
|
||||
|
||||
(call-next-method app
|
||||
(render-to-string
|
||||
(hsx (html :lang "ja"
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :cache) :dynamic)
|
||||
(setf (context :metadata) *metadata*)
|
||||
(~page))
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :cache) :dynamic)
|
||||
(setf (context :metadata) *metadata*)
|
||||
(~page))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
(defpackage #:website/routes/index
|
||||
(:use #:cl
|
||||
#:hsx)
|
||||
#:hsx
|
||||
#:jingle)
|
||||
(:export #:handle-get
|
||||
#:handle-head))
|
||||
(in-package #:website/routes/index)
|
||||
|
@ -43,6 +44,7 @@
|
|||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :cache) :static)
|
||||
(~page))
|
||||
|
||||
; for health check
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
"Back to TOP"))))
|
||||
|
||||
(defun handle-not-found ()
|
||||
(setf (context :cache) :dynamic)
|
||||
(setf (context :metadata) *metadata*)
|
||||
(~page))
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :cache) :dynamic)
|
||||
(setf (context :metadata) *metadata*)
|
||||
(~page))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue