예제 #1
0
// 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)
}
예제 #2
0
// save mysql session values to database.
// must call this method to save values to database.
func (st *MysqlSessionStore) 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`=?, `session_expiry`=? where session_key=?",
		b, time.Now().Unix(), st.sid)

}
예제 #3
0
// 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)

}
예제 #4
0
func (cs *CouchbaseSessionStore) 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)
}
예제 #5
0
// save session values to redis
func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
	c := rs.p.Get()
	defer c.Close()

	b, err := session.EncodeGob(rs.values)
	if err != nil {
		return
	}

	c.Do("SET", rs.sid, string(b), "EX", rs.maxlifetime)
}