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