Benchmark_Cache_MaxSize() — fiber Function Reference
Architecture documentation for the Benchmark_Cache_MaxSize() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 0584c3a4_c172_9e8f_9de8_768f9c24ef3a["Benchmark_Cache_MaxSize()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] 0584c3a4_c172_9e8f_9de8_768f9c24ef3a -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style 0584c3a4_c172_9e8f_9de8_768f9c24ef3a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 3408–3440
func Benchmark_Cache_MaxSize(b *testing.B) {
// The benchmark is run with three different MaxSize parameters
// 1) 0: Tracking is disabled = no overhead
// 2) MaxInt32: Enough to store all entries = no removals
// 3) 100: Small size = constant insertions and removals
cases := []uint{0, math.MaxUint32, 100}
names := []string{"Disabled", "Unlim", "LowBounded"}
for i, size := range cases {
b.Run(names[i], func(b *testing.B) {
app := fiber.New()
app.Use(New(Config{MaxBytes: size}))
app.Get("/*", func(c fiber.Ctx) error {
return c.Status(fiber.StatusTeapot).SendString("1")
})
h := app.Handler()
fctx := &fasthttp.RequestCtx{}
fctx.Request.Header.SetMethod(fiber.MethodGet)
b.ReportAllocs()
n := 0
for b.Loop() {
n++
fctx.Request.SetRequestURI(fmt.Sprintf("/%v", n))
h(fctx)
}
require.Equal(b, fiber.StatusTeapot, fctx.Response.Header.StatusCode())
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Benchmark_Cache_MaxSize() do?
Benchmark_Cache_MaxSize() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Benchmark_Cache_MaxSize() defined?
Benchmark_Cache_MaxSize() is defined in middleware/cache/cache_test.go at line 3408.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free