rediscluster

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSessionBySessionId

func LoadSessionBySessionId(s *Store, sessionId string) (*sessions.Session, error)

LoadSessionBySessionId Get session using session_id even without a context

func SaveSessionWithoutContext

func SaveSessionWithoutContext(s *Store, sessionId string, session *sessions.Session) error

SaveSessionWithoutContext Save session even without a context

Types

type Store

type Store struct {
	Rdb           *redis.ClusterClient
	Codecs        []securecookie.Codec
	Opts          *sessions.Options // default configuration
	DefaultMaxAge int               // default Redis TTL for a MaxAge == 0 session
	// contains filtered or unexported fields
}

func NewStore

func NewStore(maxIdle int, addrs []string, password string, newClient func(opt *redis.Options) *redis.Client, kvs ...[]byte) (*Store, error)

NewStore returns a new rediscluster.Store

func NewStoreWithOption

func NewStoreWithOption(opt *redis.ClusterOptions, kvs ...[]byte) (*Store, error)

NewStoreWithOption returns a new rediscluster.Store by setting *redis.ClusterOptions

func (*Store) Close

func (s *Store) Close() error

func (*Store) Get

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

func (*Store) New

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

func (*Store) Options

func (s *Store) Options(options hs.Options)

func (*Store) Save

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

func (*Store) SetKeyPrefix

func (s *Store) SetKeyPrefix(p string)

SetKeyPrefix set the prefix

func (*Store) SetMaxLength

func (s *Store) SetMaxLength(l int)

SetMaxLength sets RedisClusterStore.maxLength if the `l` argument is greater or equal 0 maxLength restricts the maximum length of new sessions to l. If l is 0 there is no limit to the size of a session, use with caution. The default for a new RedisClusterStore is 4096. Redis allows for max. value sizes of up to 512MB (http://redis.io/topics/data-types) Default: 4096,

func (*Store) SetSerializer

func (s *Store) SetSerializer(ss hs.Serializer)

SetSerializer sets the serializer

Jump to

Keyboard shortcuts

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