session.go — fiber Source File
Architecture documentation for session.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 747a200a_0b32_8d25_d7f7_852a23349c06["session.go"] c0b86961_3ef1_0168_52fc_98627566ed27["bytes"] 747a200a_0b32_8d25_d7f7_852a23349c06 --> c0b86961_3ef1_0168_52fc_98627566ed27 style 747a200a_0b32_8d25_d7f7_852a23349c06 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package session
import (
"bytes"
"context"
"encoding/gob"
"fmt"
"sync"
"time"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/extractors"
"github.com/gofiber/utils/v2"
"github.com/valyala/fasthttp"
)
// Session represents a user session.
type Session struct {
ctx fiber.Ctx // fiber context
config *Store // store configuration
data *data // key value data
id string // session id
idleTimeout time.Duration // idleTimeout of this session
mu sync.RWMutex // Mutex to protect non-data fields
fresh bool // if new session
}
type absExpirationKeyType int
const (
// sessionIDContextKey is the key used to store the session ID in the context locals.
absExpirationKey absExpirationKeyType = iota
)
// Session pool for reusing byte buffers.
var byteBufferPool = sync.Pool{
New: func() any {
return new(bytes.Buffer)
},
}
var sessionPool = sync.Pool{
New: func() any {
return &Session{}
},
}
// acquireSession returns a new Session from the pool.
//
// Returns:
// - *Session: The session object.
//
// Usage:
//
// s := acquireSession()
func acquireSession() *Session {
s := sessionPool.Get().(*Session) //nolint:forcetypeassert,errcheck // We store nothing else in the pool
if s.data == nil {
s.data = acquireData()
}
// ... (522 more lines)
Domain
Subdomains
Functions
Dependencies
- bytes
Source
Frequently Asked Questions
What does session.go do?
session.go is a source file in the fiber codebase, written in go. It belongs to the FiberMiddleware domain, Session subdomain.
What functions are defined in session.go?
session.go defines 2 function(s): acquireSession, releaseSession.
What does session.go depend on?
session.go imports 1 module(s): bytes.
Where is session.go in the architecture?
session.go is located at middleware/session/session.go (domain: FiberMiddleware, subdomain: Session, directory: middleware/session).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free