1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 19:32:58 +00:00

fix cache docs error (#1769)

This commit is contained in:
liaohongxing 2022-02-12 20:00:00 +08:00 committed by GitHub
parent b9efc76722
commit 1fd6eabba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ app.Use(New(Config{
return time.Second * time.Duration(newCacheTime)
},
KeyGenerator: func(c *fiber.Ctx) string {
return c.Path()
return utils.CopyString(c.Path())
}
}))
@ -99,7 +99,7 @@ type Config struct {
// Key allows you to generate custom keys, by default c.Path() is used
//
// Default: func(c *fiber.Ctx) string {
// return c.Path()
// return utils.CopyString(c.Path())
// }
KeyGenerator func(*fiber.Ctx) string

View File

@ -267,7 +267,7 @@ func Test_CustomKey(t *testing.T) {
var called bool
app.Use(New(Config{KeyGenerator: func(c *fiber.Ctx) string {
called = true
return c.Path()
return utils.CopyString(c.Path())
}}))
app.Get("/", func(c *fiber.Ctx) error {