session

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionFlagNone   = iota // 无数据状态
	SessionFlagModify        // 有数据状态
)

Variables

This section is empty.

Functions

func Init

func Init(options ...interface{})

func NewRedisPool

func NewRedisPool(host string, port int, password string, database int) *redis.Pool

创建Redis连接池

Types

type RedisSession

type RedisSession struct {
	SessionId string

	Expire     int
	SessionMap map[string]interface{}

	Flag int
	// contains filtered or unexported fields
}

RedisSession结构体

func (*RedisSession) Del

func (this *RedisSession) Del(key string) bool

删除Session内容

func (*RedisSession) Get

func (this *RedisSession) Get(key string) interface{}

获取Session内容

func (*RedisSession) Save

func (this *RedisSession) Save(expire ...int) (bool, error)

保存Session内容

func (*RedisSession) Set

func (this *RedisSession) Set(key string, value interface{}) bool

设置Session内容

type RedisSessionMgr

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

Session管理器结构体

var Ssmgr *RedisSessionMgr

func InitSessionMgr

func InitSessionMgr(options ...interface{}) *RedisSessionMgr

初始化Session管理器

func (*RedisSessionMgr) Del

func (this *RedisSessionMgr) Del(sessionId string) (bool, error)

从Redis中删除Session

func (*RedisSessionMgr) Get

func (this *RedisSessionMgr) Get(sessionId string) (*RedisSession, error)

读取Session

func (*RedisSessionMgr) New

func (this *RedisSessionMgr) New(options ...string) *RedisSession

新建Session

Jump to

Keyboard shortcuts

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