Documentation ¶
Index ¶
- Constants
- Variables
- func New(cfg *Options) sessions.Store
- func Reg(store sessions.Store, args ...string)
- func RegWithOptions(opts *Options, args ...string) sessions.Store
- type MySQLStore
- func (m *MySQLStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})
- func (m *MySQLStore) Close() (err error)
- func (m *MySQLStore) Delete(ctx echo.Context, session *sessions.Session) error
- func (m *MySQLStore) Get(ctx echo.Context, name string) (*sessions.Session, error)
- func (m *MySQLStore) Init()
- func (m *MySQLStore) New(ctx echo.Context, name string) (*sessions.Session, error)
- func (m *MySQLStore) Reload(ctx echo.Context, session *sessions.Session) error
- func (m *MySQLStore) Remove(sessionID string) error
- func (m *MySQLStore) Save(ctx echo.Context, session *sessions.Session) error
- func (m *MySQLStore) StopCleanup(quit chan<- struct{}, done <-chan struct{})
- type Options
Constants ¶
View Source
const DDL = "CREATE TABLE IF NOT EXISTS %s (" +
" `id` char(64) NOT NULL," +
" `data` longblob NOT NULL," +
" `created` int(11) unsigned NOT NULL DEFAULT '0'," +
" `modified` int(11) unsigned NOT NULL DEFAULT '0'," +
" `expires` int(11) unsigned NOT NULL DEFAULT '0'," +
" PRIMARY KEY (`id`)" +
" ) ENGINE=InnoDB;"
Variables ¶
View Source
var ( DefaultMaxAge = 86400 DefaultKeyPrefix = `_` )
View Source
var DefaultInterval = time.Minute * 5
Functions ¶
Types ¶
type MySQLStore ¶
type MySQLStore struct { Codecs []securecookie.Codec // contains filtered or unexported fields }
func NewMySQLStore ¶
func NewMySQLStore(endpoint string, tableName string, keyPairs ...[]byte) (*MySQLStore, error)
NewMySQLStore takes the following paramaters endpoint - A sql.Open style endpoint tableName - table where sessions are to be saved. Required fields are created automatically if the table doesnot exist. path - path for Set-Cookie header maxAge codecs
func NewMySQLStoreFromConnection ¶
func NewMySQLStoreFromConnection(db *sql.DB, tableName string, keyPairs ...[]byte) (*MySQLStore, error)
NewMySQLStoreFromConnection .
func (*MySQLStore) Cleanup ¶
func (m *MySQLStore) Cleanup(interval time.Duration) (chan<- struct{}, <-chan struct{})
Cleanup runs a background goroutine every interval that deletes expired sessions from the database.
The design is based on https://github.com/yosssi/boltstore
func (*MySQLStore) Close ¶
func (m *MySQLStore) Close() (err error)
func (*MySQLStore) Init ¶ added in v1.6.0
func (m *MySQLStore) Init()
func (*MySQLStore) Remove ¶ added in v1.6.0
func (m *MySQLStore) Remove(sessionID string) error
func (*MySQLStore) StopCleanup ¶
func (m *MySQLStore) StopCleanup(quit chan<- struct{}, done <-chan struct{})
StopCleanup stops the background cleanup from running.
Click to show internal directories.
Click to hide internal directories.