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
755 B
Go

package session
import (
"net/http"
assession "github.com/astaxie/session"
_ "github.com/astaxie/session/providers/memory"
)
// Session a Session object with all data
type Session struct {
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
func SessionDestroy(w http.ResponseWriter, r *http.Request) assession.Session {
return SessionDestroy(w, r)
}