// save session values to memcache func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) { b, err := session.EncodeGob(rs.values) if err != nil { return } item := memcache.Item{Key: rs.sid, Value: b, Expiration: int32(rs.maxlifetime)} client.Set(&item) }
// SessionRelease save session values to ledis func (ls *SessionStore) SessionRelease(w http.ResponseWriter) { b, err := session.EncodeGob(ls.values) if err != nil { return } c.Set([]byte(ls.sid), b) c.Expire([]byte(ls.sid), ls.maxlifetime) }
func (s *SessionStore) SessionRelease(w http.ResponseWriter) { b, err := session.EncodeGob(s.values) if err != nil { return } s.client.Do("setx", s.sid, string(b), s.maxLifetime) }
// SessionRelease save mysql session values to database. // must call this method to save values to database. func (st *SessionStore) SessionRelease(w http.ResponseWriter) { defer st.c.Close() b, err := session.EncodeGob(st.values) if err != nil { return } st.c.Exec("UPDATE "+TableName+" set `session_data`=?, `session_expiry`=? where session_key=?", b, time.Now().Unix(), st.sid) }
// SessionRelease save session values to redis func (rs *SessionStore) SessionRelease(w http.ResponseWriter) { b, err := session.EncodeGob(rs.values) if err != nil { return } c := rs.p.Get() defer c.Close() c.Do("SETEX", rs.sid, rs.maxlifetime, string(b)) }
// save postgresql session values to database. // must call this method to save values to database. func (st *PostgresqlSessionStore) SessionRelease(w http.ResponseWriter) { defer st.c.Close() b, err := session.EncodeGob(st.values) if err != nil { return } st.c.Exec("UPDATE session set session_data=$1, session_expiry=$2 where session_key=$3", b, time.Now().Format(time.RFC3339), st.sid) }
// SessionRelease Write couchbase session with Gob string func (cs *SessionStore) SessionRelease(w http.ResponseWriter) { defer cs.b.Close() bo, err := session.EncodeGob(cs.values) if err != nil { return } cs.b.Set(cs.sid, int(cs.maxlifetime), bo) }
// save session values to redis func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) { defer rs.c.Close() // if rs.values is empty, return directly if len(rs.values) < 1 { rs.c.Delete(rs.sid) return } b, err := session.EncodeGob(rs.values) if err != nil { return } rs.c.Set(rs.sid, 0, uint64(rs.maxlifetime), b) }
// SessionRelease save session values to redis func (rs *SessionStore) SessionRelease(w http.ResponseWriter) { b, err := session.EncodeGob(rs.values) if err != nil { return } c := rs.p.Get() defer c.Close() // Update session value if exists or error. if existed, err := redis.Bool(c.Do("EXISTS", rs.sid)); existed || err != nil { c.Do("SETEX", rs.sid, rs.maxlifetime, string(b)) } }
func (cs *CouchbaseSessionStore) SessionRelease(w http.ResponseWriter) { defer cs.b.Close() // if rs.values is empty, return directly if len(cs.values) < 1 { cs.b.Delete(cs.sid) return } bo, err := session.EncodeGob(cs.values) if err != nil { return } cs.b.Set(cs.sid, int(cs.maxlifetime), bo) }
// save session values to redis func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { c := rs.p.Get() defer c.Close() // if rs.values is empty, return directly if len(rs.values) < 1 { c.Do("DEL", rs.sid) return } b, err := session.EncodeGob(rs.values) if err != nil { return } c.Do("SET", rs.sid, string(b), "EX", rs.maxlifetime) }