Documentation
¶
Overview ¶
Package redistore is a session store backend for gorilla/sessions
Index ¶
- type JSONSerializer
- type RediStore
- func (s *RediStore) Client() redis.UniversalClient
- func (s *RediStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *RediStore) DeleteByID(ids ...string) error
- func (s *RediStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *RediStore) GetAll() ([]*sessions.Session, error)
- func (s *RediStore) KeyPrefix() string
- func (s *RediStore) MaxLength() int
- func (s *RediStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *RediStore) Options() *sessions.Options
- func (s *RediStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *RediStore) SetKeyPrefix(p string) *RediStore
- func (s *RediStore) SetMaxLength(length int) *RediStore
- func (s *RediStore) SetOptions(opts *sessions.Options) *RediStore
- func (s *RediStore) SetSerializer(serializer SessionSerializer) *RediStore
- func (s *RediStore) Update(session *sessions.Session) error
- type SessionSerializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONSerializer ¶
type JSONSerializer struct{}
JSONSerializer encode the session map to JSON.
func (JSONSerializer) Deserialize ¶
func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error
Deserialize back to map[string]interface{}
type RediStore ¶
type RediStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(client redis.UniversalClient, keyPrefix string, keyPairs ...[]byte) (*RediStore, error)
NewRedisStore returns a new RedisStore.
func (*RediStore) Client ¶
func (s *RediStore) Client() redis.UniversalClient
Client returns the Client.
func (*RediStore) DeleteByID ¶
DeleteByID deletes sessions from redis by id.
func (*RediStore) Get ¶
Get returns a session for the given name after adding it to the registry.
See gorilla/sessions FilesystemStore.Get().
func (*RediStore) New ¶
New returns a session for the given name without adding it to the registry.
See gorilla/sessions FilesystemStore.New().
func (*RediStore) SetKeyPrefix ¶
SetKeyPrefix set the prefix
func (*RediStore) SetMaxLength ¶
SetMaxLength sets RediStore.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 RediStore is 4096. Redis allows for max. value sizes of up to 512MB (http://redis.io/topics/data-types) Default: 4096,
func (*RediStore) SetOptions ¶
SetOptions set the session options
func (*RediStore) SetSerializer ¶
func (s *RediStore) SetSerializer(serializer SessionSerializer) *RediStore
SetSerializer sets the serializer.