Global returns the process-wide session manager.
()
| 41 | |
| 42 | // Global returns the process-wide session manager. |
| 43 | func Global() *Manager { |
| 44 | globalManagerOnce.Do(func() { |
| 45 | mgr := NewManager(defaultExpiry) |
| 46 | globalManagerPtr.Store(mgr) |
| 47 | go mgr.cleanupLoop() |
| 48 | }) |
| 49 | return globalManagerPtr.Load() |
| 50 | } |
| 51 | |
| 52 | // SwapGlobal replaces the global manager (for testing) and returns the previous one. |
| 53 | func SwapGlobal(mgr *Manager) *Manager { |
no test coverage detected