Skip to content

Commit

Permalink
fix cache docs error (#1769)
Browse files Browse the repository at this point in the history
  • Loading branch information
liaohongxing committed Feb 12, 2022
1 parent b9efc76 commit 1fd6eab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions middleware/cache/README.md
Expand Up @@ -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())
}
}))

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion middleware/cache/cache_test.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 1fd6eab

Please sign in to comment.