// Release releases resource and save data to provider. func (s *RedisStore) Release() error { data, err := session.EncodeGob(s.data) if err != nil { return err } return s.c.SetEx(s.sid, s.duration, string(data)).Err() }
// save postgres session values to database. // must call this method to save values to database. func (s *PostgresStore) Release() error { data, err := session.EncodeGob(s.data) if err != nil { return err } _, err = s.c.Exec("UPDATE session SET data=$1, expiry=$2 WHERE key=$3", data, time.Now().Unix(), s.sid) return err }
// Release releases resource and save data to provider. func (s *MysqlStore) Release() error { data, err := session.EncodeGob(s.data) if err != nil { return err } _, err = s.c.Exec("UPDATE session SET data=?, expiry=? WHERE `key`=?", data, time.Now().Unix(), s.sid) return err }
// Release releases resource and save data to provider. func (s *NodbStore) Release() error { data, err := session.EncodeGob(s.data) if err != nil { return err } if err = s.c.Set([]byte(s.sid), data); err != nil { return err } _, err = s.c.Expire([]byte(s.sid), s.expire) return err }