Documentation
¶
Index ¶
- type Store
- func (s *Store) All() (map[string][]byte, error)
- func (s *Store) AllCtx(ctx context.Context) (map[string][]byte, error)
- func (s *Store) Commit(token string, b []byte, expiry time.Time) error
- func (s *Store) CommitCtx(ctx context.Context, token string, data []byte, expiry time.Time) error
- func (s *Store) Delete(token string) error
- func (s *Store) DeleteCtx(ctx context.Context, token string) error
- func (s *Store) Find(token string) ([]byte, bool, error)
- func (s *Store) FindCtx(ctx context.Context, token string) ([]byte, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct{}
Store satisfies the session store interface for storing sessions in a custom backend.
func NewSessionStore ¶
NewSessionStore sets up a new session store for use by the server.
func (*Store) AllCtx ¶
AllCtx should return a map containing data for all active sessions (i.e. sessions which have not expired). The map key should be the session token and the map value should be the session data. If no active sessions exist this should return an empty (not nil) map.
func (*Store) CommitCtx ¶
CommitCtx should add the session token and data to the store, with the given expiry time. If the session token already exists, then the data and expiry time should be overwritten.
func (*Store) DeleteCtx ¶
DeleteCtx should remove the session token and corresponding data from the session store. If the token does not exist then Delete should be a no-op and return nil (not an error).
func (*Store) FindCtx ¶
FindCtx should return the data for a session token from the store. If the session token is not found or is expired, the found return value should be false (and the err return value should be nil). Similarly, tampered or malformed tokens should result in a found return value of false and a nil err value. The err return value should be used for system errors only.