Fix: session README
Showing
1 changed file
with
8 additions
and
8 deletions
| ... | @@ -32,14 +32,6 @@ Then in you web app init the global session manager | ... | @@ -32,14 +32,6 @@ Then in you web app init the global session manager |
| 32 | go globalSessions.GC() | 32 | go globalSessions.GC() |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | * 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): | ||
| 36 | |||
| 37 | func init() { | ||
| 38 | globalSessions, _ = session.NewManager( | ||
| 39 | "mysql", "gosessionid", 3600, "username:password@protocol(address)/dbname?param=value") | ||
| 40 | go globalSessions.GC() | ||
| 41 | } | ||
| 42 | |||
| 43 | * Use **file** as provider, the last param is the path where you want file to be stored: | 35 | * Use **file** as provider, the last param is the path where you want file to be stored: |
| 44 | 36 | ||
| 45 | func init() { | 37 | func init() { |
| ... | @@ -53,6 +45,14 @@ Then in you web app init the global session manager | ... | @@ -53,6 +45,14 @@ Then in you web app init the global session manager |
| 53 | globalSessions, _ = session.NewManager("redis", "gosessionid", 3600, "127.0.0.1:6379") | 45 | globalSessions, _ = session.NewManager("redis", "gosessionid", 3600, "127.0.0.1:6379") |
| 54 | go globalSessions.GC() | 46 | go globalSessions.GC() |
| 55 | } | 47 | } |
| 48 | |||
| 49 | * 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): | ||
| 50 | |||
| 51 | func init() { | ||
| 52 | globalSessions, _ = session.NewManager( | ||
| 53 | "mysql", "gosessionid", 3600, "username:password@protocol(address)/dbname?param=value") | ||
| 54 | go globalSessions.GC() | ||
| 55 | } | ||
| 56 | 56 | ||
| 57 | Finally in the handlerfunc you can use it like this | 57 | Finally in the handlerfunc you can use it like this |
| 58 | 58 | ... | ... |
-
Please register or sign in to post a comment