// Release releases resource and save data to provider. func (s *MemcacheStore) Release() error { data, err := session.EncodeGob(s.data) if err != nil { return err } return s.c.Set(NewItem(s.sid, data, s.expire)) }
// 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.prefix+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 *CouchbaseSessionStore) Release() error { defer s.b.Close() data, err := session.EncodeGob(s.data) if err != nil { return err } return s.b.Set(s.sid, int(s.maxlifetime), data) }
// 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 *LedisStore) 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 }