import "github.com/martini-contrib/sessions" func deleteSessionHandler(session sessions.Session) { session.Delete("session_key") }
import "github.com/martini-contrib/sessions" func logoutHandler(res http.ResponseWriter, req *http.Request, session sessions.Session) { sessionOptions := sessions.Options{ MaxAge: -1, } session.Options(sessionOptions) session.Delete("user_id") http.Redirect(res, req, "/", http.StatusFound) }In this example, we define a logout handler function that takes a `http.ResponseWriter`, a `*http.Request`, and a `sessions.Session` object as its arguments. Inside the function, we first create a `sessions.Options` object with a `MaxAge` of -1 to clear the session. We then set the session options using the `Options` method of the session object. Finally, we delete the "user_id" key from the session object and redirect the user back to the home page.