Exemplo n.º 1
0
// 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)
}
Exemplo n.º 2
0
// SessionRelease save session values to memcache
func (rs *SessionStore) 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)
}
Exemplo n.º 3
0
// 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)

}
Exemplo n.º 4
0
// 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)
}
Exemplo n.º 5
0
// SessionRelease save postgresql 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 session set session_data=$1, session_expiry=$2 where session_key=$3",
		b, time.Now().Format(time.RFC3339), st.sid)

}
Exemplo n.º 6
0
// 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))
	}
}