1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 17:21:02 +00:00

bug fix, session stored in redis cannot be deleted

This commit is contained in:
Pengfei Xue 2014-01-23 19:28:58 +08:00
parent 1509a6b681
commit d014ccfb8e
2 changed files with 6 additions and 0 deletions

View File

@ -398,6 +398,7 @@ func (c *Controller) SessionRegenerateID() {
// DestroySession cleans session data and session cookie. // DestroySession cleans session data and session cookie.
func (c *Controller) DestroySession() { func (c *Controller) DestroySession() {
c.Ctx.Input.CruSession.Flush()
GlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request) GlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request)
} }

View File

@ -60,6 +60,11 @@ func (rs *RedisSessionStore) SessionID() string {
} }
func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
// if rs.values is empty, return directly
if len(rs.values) < 1 {
return
}
c := rs.p.Get() c := rs.p.Get()
defer c.Close() defer c.Close()