SwapGlobal replaces the global manager (for testing) and returns the previous one.
(mgr *Manager)
| 51 | |
| 52 | // SwapGlobal replaces the global manager (for testing) and returns the previous one. |
| 53 | func SwapGlobal(mgr *Manager) *Manager { |
| 54 | globalManagerOnce.Do(func() {}) // ensure initialized |
| 55 | prev := globalManagerPtr.Swap(mgr) |
| 56 | return prev |
| 57 | } |
| 58 | |
| 59 | // NewManager creates a new Manager with the given session expiry duration. |
| 60 | func NewManager(expiry time.Duration) *Manager { |