releaseMiddleware resets and returns middleware to the pool. Parameters: - m: The middleware object to release. Usage: releaseMiddleware(m)
(m *Middleware)
| 218 | // |
| 219 | // releaseMiddleware(m) |
| 220 | func 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. |
no test coverage detected