Documentation ¶
Overview ¶
Package redistore is a session store backend for gorilla/sessions
Index ¶
- type RediStore
- func (s *RediStore) Close()
- func (s *RediStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *RediStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *RediStore) MaxLength(l int)
- func (s *RediStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *RediStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RediStore ¶
type RediStore struct { Pool *redis.Pool Codecs []securecookie.Codec Options *sessions.Options // default configuration }
RediStore stores sessions in a redis backend.
Example ¶
// RedisStore store := NewRediStore(10, "tcp", ":6379", "", []byte("secret-key")) defer store.Close()
Output:
func NewRediStore ¶
NewRediStore returns a new RediStore.
func (*RediStore) Delete ¶
Delete removes the session from redis, and sets the cookie to expire.
WARNING: This method should be considered deprecated since it is not exposed via the gorilla/sessions interface. Set session.Options.MaxAge = -1 and call Save instead. - July 18th, 2013
func (*RediStore) Get ¶
Get returns a session for the given name after adding it to the registry.
See gorilla/sessions FilesystemStore.Get().
func (*RediStore) MaxLength ¶
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)