Documentation ¶
Index ¶
- type RedisStore
- func (r *RedisStore) AllCtx(ctx context.Context) (map[string][]byte, error)
- func (r *RedisStore) Commit(token string, b []byte, expiry time.Time) error
- func (r *RedisStore) CommitCtx(ctx context.Context, token string, b []byte, expiry time.Time) error
- func (r *RedisStore) Delete(token string) error
- func (r *RedisStore) DeleteCtx(ctx context.Context, token string) error
- func (r *RedisStore) Find(token string) ([]byte, bool, error)
- func (r *RedisStore) FindCtx(ctx context.Context, token string) (b []byte, exists bool, err 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 represents the session store.
func New ¶
func New(client *redis.Client) *RedisStore
New returns a new RedisStore instance. The client parameter should be a pointer to a go-redis connection.
func NewWithPrefix ¶
func NewWithPrefix(client *redis.Client, prefix string) *RedisStore
NewWithPrefix returns a new RedisStore instance. The pool parameter should be a pointer to a redigo connection pool. The prefix parameter controls the Redis key prefix, which can be used to avoid naming clashes if necessary.
func (*RedisStore) AllCtx ¶
AllCtx returns a map containing the token and data for all active (i.e. not expired) sessions in the RedisStore instance.
func (*RedisStore) CommitCtx ¶
CommitCtx adds a session token and data to the RedisStore instance with the given expiry time. If the session token already exists then the data and expiry time are updated.
func (*RedisStore) Delete ¶
func (r *RedisStore) Delete(token string) error
func (*RedisStore) DeleteCtx ¶
func (r *RedisStore) DeleteCtx(ctx context.Context, token string) error
DeleteCtx removes a session token and corresponding data from the RedisStore instance.