MCPcopy
hub / github.com/gofiber/fiber / releaseMiddleware

Function releaseMiddleware

middleware/session/middleware.go:220–231  ·  view source on GitHub ↗

releaseMiddleware resets and returns middleware to the pool. Parameters: - m: The middleware object to release. Usage: releaseMiddleware(m)

(m *Middleware)

Source from the content-addressed store, hash-verified

218//
219// releaseMiddleware(m)
220func releaseMiddleware(m *Middleware) {
221 m.mu.Lock()
222 if m.ctx != nil {
223 clearMiddlewareContext(m.ctx)
224 }
225 m.config = Config{}
226 m.Session = nil
227 m.ctx = nil
228 m.isDestroyed = false
229 m.mu.Unlock()
230 middlewarePool.Put(m)
231}
232
233// FromContext returns the Middleware from the Fiber context.
234// It accepts fiber.CustomCtx, fiber.Ctx, *fasthttp.RequestCtx, and context.Context.

Callers 1

NewWithStoreFunction · 0.85

Calls 4

clearMiddlewareContextFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected