session

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

*

*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoSessionNode

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

================================不同数据源的实现===================================== 系统自带 gocache 存储

func (*GoSessionNode) Del

func (g *GoSessionNode) Del(id string) error

func (*GoSessionNode) Expired

func (g *GoSessionNode) Expired(id string) bool

func (*GoSessionNode) Get

func (g *GoSessionNode) Get(id string) (*Session, error)

func (*GoSessionNode) Set

func (g *GoSessionNode) Set(data *Session) (string, error)

func (*GoSessionNode) SetTime

func (g *GoSessionNode) SetTime(data *Session, tim time.Duration) (string, error)

type Session

type Session struct {
	Data map[string]interface{} // 存储器

	CreationTime   int64 // 创建时间
	ExpirationTime int64 // 过期时间
	// contains filtered or unexported fields
}

session node

func (*Session) GetVal

func (s *Session) GetVal(key string) (interface{}, bool)

func (*Session) SetKey

func (s *Session) SetKey(key string, value interface{})

type SessionEngine

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

func GetSessionCache

func GetSessionCache() *SessionEngine

func (*SessionEngine) Del added in v0.0.17

func (s *SessionEngine) Del(ctx *erguotou.Context) error

func (*SessionEngine) Get

func (s *SessionEngine) Get(ctx *erguotou.Context, key string) (interface{}, bool)

func (*SessionEngine) Save

func (s *SessionEngine) Save(ctx *erguotou.Context) error

func (*SessionEngine) SaveTime

func (s *SessionEngine) SaveTime(ctx *erguotou.Context, time time.Duration) error

func (*SessionEngine) Set

func (s *SessionEngine) Set(key string, val interface{})

type SessionInterface

type SessionInterface interface {
	Get(id string) (*Session, error)                          // 拥有通过id获取session
	Set(data *Session) (string, error)                        // 返回id and 错误信息
	SetTime(data *Session, tim time.Duration) (string, error) // 返回id and 错误信息
	Del(id string) error
	Expired(id string) bool // 检测是否过期  过期返回false 反之true
}

Jump to

Keyboard shortcuts

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