sessions

package
v0.0.0-...-be147c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearExpiredSessions

func ClearExpiredSessions()

ClearExpiredSessions deletes all expired Sessions from the database

func RegularlyClearExpiredSessions

func RegularlyClearExpiredSessions()

RegularlyClearExpiredSessions starts a goroutine which calls ClearExpiredSessions() regularly. It initially does a clean-up (which briefly blocks) and then starts the regular clean-up job in the background.

func Start

func Start()

Start sets-up and starts the necessary ceremony to support Session

Types

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a User session, pretty much like PHP_SESSION in the old days. It is an abstraction to the `session` table in the database. We are using database-backed session in order to be able to communicate the Session to other hosts on the cluster for load-balancing purpose.

func NewSession

func NewSession(data interface{}) *Session

NewSession returns a new *Session which is given a unique UUID

func ResumeSession

func ResumeSession(uuid string) (*Session, error)

ResumeSession returns the Session from the cache or the database

func (*Session) GetUUID

func (s *Session) GetUUID() string

GetUUID returns the UUID of the Session

func (*Session) KeepAlive

func (s *Session) KeepAlive() chan<- struct{}

KeepAlive keeps the Session alive until the returned channel is closed. Note that the channel needs to closed, otherwise the Session will never die.

func (*Session) Touch

func (s *Session) Touch()

Touch keeps the Session alive

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL