Test_CacheInvalidation_removeFromHeap() — fiber Function Reference
Architecture documentation for the Test_CacheInvalidation_removeFromHeap() function in cache_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 00cccb03_1e8b_1e43_c102_2d0a5e753e12["Test_CacheInvalidation_removeFromHeap()"] 8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"] 00cccb03_1e8b_1e43_c102_2d0a5e753e12 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656 style 00cccb03_1e8b_1e43_c102_2d0a5e753e12 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/cache/cache_test.go lines 1329–1365
func Test_CacheInvalidation_removeFromHeap(t *testing.T) {
t.Parallel()
t.Run("Invalidate and remove from the heap", func(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Use(New(Config{
CacheInvalidator: func(c fiber.Ctx) bool {
return fiber.Query[bool](c, "invalidate")
},
MaxBytes: 10 * 1024 * 1024,
}))
count := 0
app.Get("/", func(c fiber.Ctx) error {
count++
return c.SendString(strconv.Itoa(count))
})
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err)
body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
respCached, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
require.NoError(t, err)
bodyCached, err := io.ReadAll(respCached.Body)
require.NoError(t, err)
require.True(t, bytes.Equal(body, bodyCached))
require.NotEmpty(t, respCached.Header.Get(fiber.HeaderCacheControl))
respInvalidate, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/?invalidate=true", http.NoBody))
require.NoError(t, err)
bodyInvalidate, err := io.ReadAll(respInvalidate.Body)
require.NoError(t, err)
require.NotEqual(t, body, bodyInvalidate)
})
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_CacheInvalidation_removeFromHeap() do?
Test_CacheInvalidation_removeFromHeap() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_CacheInvalidation_removeFromHeap() defined?
Test_CacheInvalidation_removeFromHeap() is defined in middleware/cache/cache_test.go at line 1329.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free