1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

Add iris.DestroySessionByID(string) and iris.DestroyAllSessions() as requested.

This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-01-08 06:11:50 +02:00
parent 7df9b2b437
commit bcc35c11ca
4 changed files with 60 additions and 4 deletions

18
iris.go
View File

@@ -81,7 +81,7 @@ const (
// IsLongTermSupport flag is true when the below version number is a long-term-support version
IsLongTermSupport = false
// Version is the current version number of the Iris web framework
Version = "6.0.4"
Version = "6.0.5"
banner = ` _____ _
|_ _| (_)
@@ -791,6 +791,22 @@ func (s *Framework) UseSessionDB(db sessions.Database) {
s.sessions.UseDatabase(db)
}
// DestroySessionByID removes the session entry
// from the server-side memory (and database if registered).
// Client's session cookie will still exist but it will be reseted on the next request.
//
// It's safe to use it even if you are not sure if a session with that id exists.
func (s *Framework) DestroySessionByID(sid string) {
s.sessions.DestroyByID(sid)
}
// DestroyAllSessions removes all sessions
// from the server-side memory (and database if registered).
// Client's session cookie will still exist but it will be reseted on the next request.
func (s *Framework) DestroyAllSessions() {
s.sessions.DestroyAll()
}
// UseSerializer accepts a Serializer and the key or content type on which the developer wants to register this serializer
// the gzip and charset are automatically supported by Iris, by passing the iris.RenderOptions{} map on the context.Render
// context.Render renders this response or a template engine if no response engine with the 'key' found