store

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieOption

type CookieOption struct {
	Name       string `json:"name"`
	Path       string `json:"path"`
	Domain     string `json:"domain"`
	MaxAge     int    `json:"max_age"`
	IsHttpOnly bool   `json:"is_http_only"`
	IsSecure   bool   `json:"is_secure"`
}

================================================================================ * cookie store interface * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

type ICookieStore

type ICookieStore interface {
	IStore
	Options(CookieOption)
}

================================================================================ * cookie store interface * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

func NewCookieStore

func NewCookieStore(keyPairs ...[]byte) ICookieStore

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Session会话Cookie存储 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

type IRedisStore

type IRedisStore interface {
	IStore
	Options(CookieOption)
}

================================================================================ * redis store interface * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

func NewRedisStore

func NewRedisStore(ip string, port int, password, prefixKey string, encryptKey []byte, dbIndex int) IRedisStore

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Session会话Cookie存储 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

type IStore

type IStore interface {
	sessions.Store
}

================================================================================ * cookie store interface * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

type RedisOption

type RedisOption struct {
	Host     string
	Port     int
	Password string
	Prefix   string
	Db       int
}

================================================================================ * redis store interface * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

type RedisStoreImpl

type RedisStoreImpl struct {
	Pool          *redis.Pool
	Options       *sessions.Options
	DefaultMaxAge int
	// contains filtered or unexported fields
}

================================================================================ * redis store impl * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================

func NewRedisStoreImpl

func NewRedisStoreImpl(network, address, password string, encryptKey []byte, size, dbIndex int) (*RedisStoreImpl, error)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 实例化RedisStoreImpl * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func NewRedisStoreImplWithPool

func NewRedisStoreImplWithPool(pool *redis.Pool, encryptKey []byte) (*RedisStoreImpl, error)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 实例化RedisPool * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) Close

func (s *RedisStoreImpl) Close() error

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 关闭redis链接 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) Get

func (s *RedisStoreImpl) Get(r *http.Request, name string) (*sessions.Session, error)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取会话 * IStore接口实现 * 第一次会回调当前store的New,实例化Store * 随后会从Register缓存sessions map[string]sessionInfo的里取出sessionInfo对象里的s值即sessions.Session对象 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) New

func (s *RedisStoreImpl) New(request *http.Request, name string) (*sessions.Session, error)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 实例化会话 * IStore接口实现 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) Save

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 保存会话 * IStore接口实现 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) SetMaxAge

func (s *RedisStoreImpl) SetMaxAge(maxAge int)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置会话最大有效时间(单位:秒) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) SetMaxLength

func (s *RedisStoreImpl) SetMaxLength(maxLength int)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置最大长度 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

func (*RedisStoreImpl) SetPrefix

func (s *RedisStoreImpl) SetPrefix(prefix string)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置Redis Key 前缀 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Jump to

Keyboard shortcuts

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