Increased cache time
This commit is contained in:
parent
22e1d72e01
commit
e392e7ba8b
5
main.go
5
main.go
@ -27,14 +27,13 @@ var chrome *svg2png.Chrome
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
chrome = svg2png.NewChrome().SetHeight(600).SetWith(1200).SetTimeout(10 * time.Second)
|
chrome = svg2png.NewChrome().SetHeight(600).SetWith(1200).SetTimeout(10 * time.Second)
|
||||||
|
ch := cache.New(24*time.Hour, 48*time.Hour)
|
||||||
|
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
app.Use(compress.New())
|
app.Use(compress.New())
|
||||||
app.Use(cors.New())
|
app.Use(cors.New())
|
||||||
app.Use(logger.New())
|
app.Use(logger.New())
|
||||||
|
|
||||||
ch := cache.New(6*time.Hour, 24*time.Hour)
|
|
||||||
|
|
||||||
app.Get("/", func(c *fiber.Ctx) error {
|
app.Get("/", func(c *fiber.Ctx) error {
|
||||||
c.Type("html", "UTF8")
|
c.Type("html", "UTF8")
|
||||||
body, _ := content.ReadFile("index.html")
|
body, _ := content.ReadFile("index.html")
|
||||||
@ -64,7 +63,7 @@ func main() {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return c.SendStatus(500)
|
return c.SendStatus(500)
|
||||||
}
|
}
|
||||||
ch.Set(key, png, 0)
|
ch.Set(key, png, cache.DefaultExpiration)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Type("png")
|
c.Type("png")
|
||||||
|
Loading…
Reference in New Issue
Block a user