top

package mysql for session provider

depends on github.com/go-sql-driver/mysql:

go install github.com/go-sql-driver/mysql

mysql session support need create table as sql:

CREATE TABLE `session` (
`session_key` char(64) NOT NULL,
session_data` blob,
`session_expiry` int(11) unsigned NOT NULL,
PRIMARY KEY (`session_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Usage: import(

_ "github.com/aamsur/beego/session/mysql"
"github.com/aamsur/beego/session"

)

func init() {
	globalSessions, _ = session.NewManager("mysql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]"}``)
	go globalSessions.GC()
}

more docs: http://beego.me/docs/module/session.md

Imports 2 package(s) ΒΆ

  1. github.com/aamsur/beego/session
  2. github.com/go-sql-driver/mysql