Added page cache middleware.

This commit is contained in:
mikestefanello 2021-12-07 21:36:57 -05:00
parent 855d67409f
commit 30dced6315
6 changed files with 80 additions and 17 deletions

View file

@ -33,9 +33,10 @@ type Page struct {
Description string
Keywords []string
}
Pager pager.Pager
CSRF string
Cache struct {
Pager pager.Pager
CSRF string
Headers map[string]string
Cache struct {
Enabled bool
MaxAge time.Duration
Tags []string
@ -49,6 +50,7 @@ func NewPage(c echo.Context) Page {
Path: c.Request().URL.Path,
StatusCode: http.StatusOK,
Pager: pager.NewPager(c, DefaultItemsPerPage),
Headers: make(map[string]string),
}
p.IsHome = p.Path == "/"