diff options
Diffstat (limited to 'sessions.go')
-rw-r--r-- | sessions.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sessions.go b/sessions.go index c0139a6..865d952 100644 --- a/sessions.go +++ b/sessions.go @@ -103,15 +103,14 @@ const registryKey = `webx:mw.sessions` // GetRegistry returns a registry instance for the current request. func GetRegistry(ctx echo.Context) *Registry { - registry, ok := ctx.Get(registryKey).(*Registry) - if ok { - return registry - } - registry = &Registry{ + registry := &Registry{ context: ctx, sessions: make(map[string]sessionInfo), } - ctx.Set(registryKey, registry) + actual, loaded := ctx.Internal().LoadOrStore(registryKey, registry) + if loaded { + registry = actual.(*Registry) + } return registry } |