mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:20:54 +00:00
Fix: session README
This commit is contained in:
parent
cc6c84b317
commit
43f588b5c1
@ -32,14 +32,6 @@ Then in you web app init the global session manager
|
|||||||
go globalSessions.GC()
|
go globalSessions.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
* Use **MySQL** as provider, the last param is the DNS, learn more from [mysql](https://github.com/Go-SQL-Driver/MySQL#dsn-data-source-name):
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
globalSessions, _ = session.NewManager(
|
|
||||||
"mysql", "gosessionid", 3600, "username:password@protocol(address)/dbname?param=value")
|
|
||||||
go globalSessions.GC()
|
|
||||||
}
|
|
||||||
|
|
||||||
* Use **file** as provider, the last param is the path where you want file to be stored:
|
* Use **file** as provider, the last param is the path where you want file to be stored:
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -53,6 +45,14 @@ Then in you web app init the global session manager
|
|||||||
globalSessions, _ = session.NewManager("redis", "gosessionid", 3600, "127.0.0.1:6379")
|
globalSessions, _ = session.NewManager("redis", "gosessionid", 3600, "127.0.0.1:6379")
|
||||||
go globalSessions.GC()
|
go globalSessions.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* Use **MySQL** as provider, the last param is the DSN, learn more from [mysql](https://github.com/Go-SQL-Driver/MySQL#dsn-data-source-name):
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
globalSessions, _ = session.NewManager(
|
||||||
|
"mysql", "gosessionid", 3600, "username:password@protocol(address)/dbname?param=value")
|
||||||
|
go globalSessions.GC()
|
||||||
|
}
|
||||||
|
|
||||||
Finally in the handlerfunc you can use it like this
|
Finally in the handlerfunc you can use it like this
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user