session

package
v0.0.0-...-bd13ba8 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_SCAN_TIME = 5 //second
)

Variables

This section is empty.

Functions

func CreateSessionManager

func CreateSessionManager(context *appcontext.AppContext, sessionProviderMap map[string]SessionProvider)

func DeseriazeObject

func DeseriazeObject(bytearray []byte, obj interface{}) bool

func GetInvalidateTime

func GetInvalidateTime(timeOut int64) time.Time

func GetSessionManager

func GetSessionManager() *sessionManager

func SerializeSession

func SerializeSession(session Session) string

func SerializeSessionInfo

func SerializeSessionInfo(sessionInfo SessionInfo) string

func StartSessionManager

func StartSessionManager()

func StopSessionManager

func StopSessionManager()

Types

type Session

type Session struct {
	SessionId            string
	SessionValue         map[string]interface{}
	SessionSerializeInfo map[string][]byte
}

func DeserializeSession

func DeserializeSession(sessionStr string) *Session

func NewSession

func NewSession(r *http.Request, w http.ResponseWriter) Session

func (*Session) DeleteSessionValue

func (this *Session) DeleteSessionValue(valueId string)

func (*Session) GetSessionValue

func (this *Session) GetSessionValue(valueId string, obj interface{}) bool

func (*Session) InitSession

func (this *Session) InitSession(id string)

func (*Session) SaveSessionValue

func (this *Session) SaveSessionValue(valueId string, obj interface{})

type SessionInfo

type SessionInfo struct {
	SessionId             string
	SessionInvalidateTime time.Time
	IsSerialized          bool
}

func DeserializeSessionInfo

func DeserializeSessionInfo(sessionInfoStr string) *SessionInfo

func (*SessionInfo) InitSession

func (this *SessionInfo) InitSession(timeOut int)

func (*SessionInfo) UpdateSession

func (this *SessionInfo) UpdateSession(timeOut int)

type SessionProvider

type SessionProvider interface {
	InitProvider(SessionLifeTime int64)
	CreateSession(sessionId string) (Session, error)
	DeleteSession(sessionId string) error
	FindSessionById(sessionId string) bool
	LoadSessionById(sessionId string) (Session, error)
	SerializeSession()
	DeserializeSession()
	ClearSession(sessionAccess *sync.Mutex)
	DeseriazeObject(valueId string, bytearray []byte, obj interface{}, sess *Session) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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