redisstore

package
v0.0.0-...-3daee64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisStore

type RedisStore struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

RedisStore represents the session store.

func New

func New(redis *redis.Redis) *RedisStore

New returns a new RedisStore instance. The pool parameter should be a pointer to a redigo connection pool. See https://godoc.org/github.com/gomodule/redigo/redis#Pool.

func NewWithPrefix

func NewWithPrefix(redis *redis.Redis, 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) Commit

func (r *RedisStore) Commit(token string, b []byte, expiry time.Time) error

Commit 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

Delete removes a session token and corresponding data from the RedisStore instance.

func (*RedisStore) Find

func (r *RedisStore) Find(token string) (b []byte, exists bool, err error)

Find returns the data for a given session token from the RedisStore instance. If the session token is not found or is expired, the returned exists flag will be set to false.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL