Documentation ¶
Index ¶
- type RedisStore
- func (r *RedisStore) Create(ctx context.Context, s sessionup.Session) error
- func (r *RedisStore) DeleteByID(ctx context.Context, id string) error
- func (r *RedisStore) DeleteByUserKey(ctx context.Context, key string, expIDs ...string) error
- func (r *RedisStore) FetchByID(ctx context.Context, id string) (sessionup.Session, bool, error)
- func (r *RedisStore) FetchByUserKey(ctx context.Context, key string) ([]sessionup.Session, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore is a Redis implementation of sessionup.Store.
func New ¶
func New(pool *redis.Pool, prefix string) *RedisStore
New returns a fresh instance of RedisStore. prefix parameter determines the prefix that will be used for each session key (might be empty string). Useful when working with multiple session managers.
func (*RedisStore) Create ¶
Create inserts the provided session into the store and ensures that it is deleted when expiration time due.
func (*RedisStore) DeleteByID ¶
func (r *RedisStore) DeleteByID(ctx context.Context, id string) error
DeleteByID deletes the session from the store by the provided ID. If session is not found, this function will be no-op.
func (*RedisStore) DeleteByUserKey ¶
DeleteByUserKey deletes all sessions associated with the provided user key, except those whose IDs are provided as the last argument. If none are found, this function will no-op.
func (*RedisStore) FetchByID ¶
FetchByID retrieves a session from the store by the provided ID. The second returned value indicates whether the session was found or not (true == found), error should will be nil if session is not found.
func (*RedisStore) FetchByUserKey ¶
FetchByUserKey retrieves all sessions associated with the provided user key. If none are found, both return values will be nil.