goredisSentinelstore

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 15 Imported by: 0

README

redigoSentinelstore

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *log.Logger
View Source
var MySentinel *redis.Client

Functions

func NewNegroniSentinelGobStore

func NewNegroniSentinelGobStore(Sentinel *redis.Client, sessionExpire int, keyPairs ...[]byte) nSessions.Store

New returns a new Sentinel store

func NewNegroniSentinelJsonStore

func NewNegroniSentinelJsonStore(Sentinel *redis.Client, sessionExpire int, keyPairs ...[]byte) nSessions.Store

func RedisInit

func RedisInit(rc *RedisConf) (*redis.Client, error)

Types

type GobSerializer

type GobSerializer struct{}

Gob 序列化类型

func (GobSerializer) Deserialize

func (s GobSerializer) Deserialize(d []byte, ss *sessions.Session) error

Gob 反序列化

func (GobSerializer) Serialize

func (s GobSerializer) Serialize(ss *sessions.Session) ([]byte, error)

Gob 序列化

type JSONSerializer

type JSONSerializer struct{}

json 序列化类型

func (JSONSerializer) Deserialize

func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error

json 反序列化

func (JSONSerializer) Serialize

func (s JSONSerializer) Serialize(ss *sessions.Session) ([]byte, error)

json 序列化

type NegroniSentinleStore

type NegroniSentinleStore struct {
	*SentinleStore
}

func (*NegroniSentinleStore) Options

func (c *NegroniSentinleStore) Options(options nSessions.Options)

type RedisConf

type RedisConf struct {
	Password   string
	DB         int
	TimeOut    int
	Pool       int
	MasterName string
	Sentinels  []string
}
var MyRedisConf *RedisConf

type SentinleStore

type SentinleStore struct {
	Sentinel      *redis.Client
	Codecs        []securecookie.Codec
	Options       *sessions.Options
	DefaultMaxAge int
	// contains filtered or unexported fields
}

SentinleStore类型

func NewSentinelGobStore

func NewSentinelGobStore(Sentinel *redis.Client, sessionExpire int, keyPairs ...[]byte) *SentinleStore

创建sentine store

func NewSentinelJsonStore

func NewSentinelJsonStore(Sentinel *redis.Client, sessionExpire int, keyPairs ...[]byte) *SentinleStore

func (*SentinleStore) Close

func (s *SentinleStore) Close() error

Close sentinel 连接

func (*SentinleStore) Delete

func (s *SentinleStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

删除session信息

func (*SentinleStore) Get

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

获取session 实例

See gorilla/sessions FilesystemStore.Get().

func (*SentinleStore) New

func (s *SentinleStore) New(r *http.Request, name string) (*sessions.Session, error)

返回一个新session实例

See gorilla/sessions FilesystemStore.New().

func (*SentinleStore) Save

保存session信息

func (*SentinleStore) SetKeyPrefix

func (s *SentinleStore) SetKeyPrefix(p string)

设置prefix

func (*SentinleStore) SetMaxAge

func (s *SentinleStore) SetMaxAge(v int)

设置最大的cookie过期时间

func (*SentinleStore) SetMaxLength

func (s *SentinleStore) SetMaxLength(l int)

设置允许的最大长度 默认4096

func (*SentinleStore) SetSerializer

func (s *SentinleStore) SetSerializer(ss SessionSerializer)

设置序列化工具

type SessionSerializer

type SessionSerializer interface {
	Deserialize(d []byte, ss *sessions.Session) error
	Serialize(ss *sessions.Session) ([]byte, error)
}

会话序列化接口

Jump to

Keyboard shortcuts

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