-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Question Description
Is it by design or a bug that the Next function is not called when the KeyGenerator config is defined?
Code Snippet (optional)
package main
import "github.com/gofiber/fiber/v2"
import "github.com/gofiber/fiber/v2/middleware/cache"
import "log"
func main() {
app := fiber.New()
app.Use(cache.New(cache.Config{
Next: func(c *fiber.Ctx) bool {
panic("not called")
return c.Query("noCache") == "true"
},
KeyGenerator: func(c *fiber.Ctx) string {
return fmt.Sprintf("report-%s", c.Query("startDate"))
},
Expiration: 30 * time.Minute,
CacheControl: false,
}))
log.Fatal(app.Listen(":3000"))
}Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my questions prior to opening this one.
- I understand that improperly formatted questions may be closed without explanation.
Reactions are currently unavailable