mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 13:05:56 +00:00
Add iris.DestroySessionByID(string) and iris.DestroyAllSessions() as requested. Read HISTORY.md
c9d94b7b44
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
## 6.0.4 -> 6.0.5
|
||||
|
||||
- Add `iris.DestroySessionByID(string)` and `iris.DestroyAllSessions()` functions as requested by a community member in the [chat]https://kataras.rocket.chat/channel/iris):
|
||||
- Add `iris.DestroySessionByID(string)` and `iris.DestroyAllSessions()` functions as requested by a community member in the [chat](https://kataras.rocket.chat/channel/iris):
|
||||
|
||||
```go
|
||||
// DestroySessionByID removes the session entry
|
||||
|
||||
18
iris.go
18
iris.go
@@ -154,6 +154,8 @@ type (
|
||||
ReleaseCtx(*Context)
|
||||
CheckForUpdates(bool)
|
||||
UseSessionDB(sessions.Database)
|
||||
DestroySessionByID(sid string)
|
||||
DestroyAllSessions()
|
||||
UseSerializer(string, serializer.Serializer)
|
||||
UseTemplate(template.Engine) *template.Loader
|
||||
UsePreRender(PreRender)
|
||||
@@ -791,6 +793,15 @@ 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 DestroySessionByID(sid string) {
|
||||
Default.DestroySessionByID(sid)
|
||||
}
|
||||
|
||||
// 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.
|
||||
@@ -800,6 +811,13 @@ 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 DestroyAllSessions() {
|
||||
Default.DestroyAllSessions()
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user