sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
warehost/lib/session/main.go

37 lines
738 B
Go
Raw Permalink Normal View History

2016-10-11 20:16:24 +02:00
package session
import (
"net/http"
assession "github.com/astaxie/session"
_ "github.com/astaxie/session/providers/memory"
)
// Session a Session object with all data
2016-10-11 20:34:00 +02:00
type Session interface {
2016-10-11 20:16:24 +02:00
assession.Session
}
// Data of readed configuration
var data *assession.Manager
// Init session manager
func Init() {
data, _ = assession.NewManager("memory", "session", 3600)
}
// Stop cleanup session manager
func Stop() {
data.GC()
}
// SessionStart init a session on a request
func SessionStart(w http.ResponseWriter, r *http.Request) assession.Session {
return data.SessionStart(w, r)
}
// SessionDestroy destroy a session on a request
2016-10-12 22:28:10 +02:00
func SessionDestroy(w http.ResponseWriter, r *http.Request) {
data.SessionDestroy(w, r)
2016-10-11 20:16:24 +02:00
}