diff --git a/controller.go b/controller.go index 034e4cb3..83aaacfc 100644 --- a/controller.go +++ b/controller.go @@ -398,6 +398,7 @@ func (c *Controller) SessionRegenerateID() { // DestroySession cleans session data and session cookie. func (c *Controller) DestroySession() { + c.Ctx.Input.CruSession.Flush() GlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request) } diff --git a/session/sess_redis.go b/session/sess_redis.go index d19f316f..0326c6c2 100644 --- a/session/sess_redis.go +++ b/session/sess_redis.go @@ -60,6 +60,11 @@ func (rs *RedisSessionStore) SessionID() string { } func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { + // if rs.values is empty, return directly + if len(rs.values) < 1 { + return + } + c := rs.p.Get() defer c.Close()