Skip to content

Commit

Permalink
optimize session
Browse files Browse the repository at this point in the history
  • Loading branch information
kkumar-gcc committed Sep 12, 2024
1 parent 46066d3 commit e87b4f7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions session/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@ func NewManager(config config.Config, json foundation.Json) *Manager {
return manager
}

func (m *Manager) AcquireSession() *Session {
session := m.sessionPool.Get().(*Session)
return session
}

func (m *Manager) BuildSession(handler sessioncontract.Driver, sessionID ...string) sessioncontract.Session {
if handler == nil {
panic("session driver cannot be nil")
}
session := m.AcquireSession()
session := m.acquireSession()
session.setDriver(handler)
session.setJson(m.json)
session.SetName(m.config.GetString("session.cookie"))
Expand Down Expand Up @@ -91,6 +86,11 @@ func (m *Manager) ReleaseSession(session sessioncontract.Session) {
m.sessionPool.Put(s)
}

func (m *Manager) acquireSession() *Session {
session := m.sessionPool.Get().(*Session)
return session
}

func (m *Manager) getDefaultDriver() string {
return m.config.GetString("session.driver")
}
Expand Down

0 comments on commit e87b4f7

Please sign in to comment.