mirror of
https://github.com/astaxie/beego.git
synced 2025-07-10 10:10:18 +00:00
session destroy
This commit is contained in:
@ -98,18 +98,13 @@ func (rs *SessionStore) SessionID() string {
|
||||
|
||||
// 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))
|
||||
}
|
||||
c.Do("SETEX", rs.sid, rs.maxlifetime, string(b))
|
||||
}
|
||||
|
||||
// Provider redis session provider
|
||||
|
Reference in New Issue
Block a user