load reads a file and decodes its content into session.Values.
(session *Session)
| 272 | |
| 273 | // load reads a file and decodes its content into session.Values. |
| 274 | func (s *FilesystemStore) load(session *Session) error { |
| 275 | filename := filepath.Join(s.path, sessionFilePrefix+filepath.Base(session.ID)) |
| 276 | fileMutex.RLock() |
| 277 | defer fileMutex.RUnlock() |
| 278 | fdata, err := os.ReadFile(filepath.Clean(filename)) |
| 279 | if err != nil { |
| 280 | return err |
| 281 | } |
| 282 | if err = securecookie.DecodeMulti(session.Name(), string(fdata), |
| 283 | &session.Values, s.Codecs...); err != nil { |
| 284 | return err |
| 285 | } |
| 286 | return nil |
| 287 | } |
| 288 | |
| 289 | // delete session file |
| 290 | func (s *FilesystemStore) erase(session *Session) error { |