Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cache docs error #1769

Merged
merged 1 commit into from Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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