diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-30 00:45:25 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-30 00:45:25 +0300 |
commit | 623eaf165a4f248681acfec094f2f1ac1e0ff89f (patch) | |
tree | 54a7b7c0be2002b4d9c4d59081e0e9c2bb84628b /middleware/session/memstore.go | |
parent | c261597b9adb827bfa16de8f21ce47ac63bec138 (diff) |
Пересмотрел механизм сессий
Diffstat (limited to 'middleware/session/memstore.go')
-rw-r--r-- | middleware/session/memstore.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/middleware/session/memstore.go b/middleware/session/memstore.go index 2fcef39..d8cb958 100644 --- a/middleware/session/memstore.go +++ b/middleware/session/memstore.go @@ -1,7 +1,6 @@ package session import ( - "context" "sync" ) @@ -9,22 +8,22 @@ type MemoryStore struct { store sync.Map } -func (s *MemoryStore) Load(ctx context.Context, sessionID string) Value { +func (s *MemoryStore) Load(sessionID string) Values { val, ok := s.store.Load(sessionID) if ok { - return val.(Value) + return val.(Values) } - return Value{} + return Values{} } -func (s *MemoryStore) Save(ctx context.Context, sessionID string, value Value) error { +func (s *MemoryStore) Save(sessionID string, value Values) error { s.store.Store(sessionID, value) return nil } -func (s *MemoryStore) Remove(ctx context.Context, sessionID string) error { +func (s *MemoryStore) Remove(sessionID string) error { s.store.Delete(sessionID) return nil |