MCPcopy
hub / github.com/gorilla/sessions / load

Method load

store.go:274–287  ·  view source on GitHub ↗

load reads a file and decodes its content into session.Values.

(session *Session)

Source from the content-addressed store, hash-verified

272
273// load reads a file and decodes its content into session.Values.
274func (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
290func (s *FilesystemStore) erase(session *Session) error {

Callers 1

NewMethod · 0.95

Calls 1

NameMethod · 0.80

Tested by

no test coverage detected