// Load loads a session for the given key. func (s *MemcacheSessionStore) Load(r *http.Request, key string, info *sessions.SessionInfo) { data := sessions.GetCookie(s, r, key) if sidval, ok := data["sid"]; ok { // Cleanup session data. sid := sidval.(string) for k, _ := range data { delete(data, k) } // Get session from memcache and deserialize it. c := appengine.NewContext(r) if item, err := memcache.Get(c, sessionKey(sid)); err == nil { data, _ = sessions.DeserializeSessionData(item.Value) } } info.Data = data }
// Load loads a session for the given key. func (s *DatastoreSessionStore) Load(r *http.Request, key string, info *sessions.SessionInfo) { data := sessions.GetCookie(s, r, key) if sidval, ok := data["sid"]; ok { // Cleanup session data. sid := sidval.(string) for k, _ := range data { delete(data, k) } // Get session from datastore and deserialize it. c := appengine.NewContext(r) var session Session key := datastore.NewKey(c, "Session", sessionKey(sid), 0, nil) if err := datastore.Get(c, key, &session); err == nil { data, _ = sessions.DeserializeSessionData(session.Value) } } info.Data = data }