Documentation ¶
Overview ¶
Package redisstore is a Redis-based storage engine for the SCS session package.
Warning: The redisstore API is not finalized and may change, possibly significantly. The package is fine to use as-is, but it is strongly recommended that you vendor the package to avoid compatibility problems in the future.
The redisstore package relies on the the popular Redigo Redis client (https://github.com/garyburd/redigo).
Usage:
func main() { // Establish a Redigo connection pool following instructions at // https://godoc.org/github.com/garyburd/redigo/redis#Pool pool := &redis.Pool{ MaxIdle: 10, Dial: func() (redis.Conn, error) { return redis.Dial("tcp", "localhost:6379") }, } // Create a new RedisStore instance using the connection pool. engine := redisstore.New(pool) sessionManager := session.Manage(engine) http.ListenAndServe(":4000", sessionManager(http.DefaultServeMux)) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Prefix = "scs:session:"
Prefix controls the Redis key prefix. You should only need to change this if there is a naming clash.
Functions ¶
This section is empty.
Types ¶
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore represents the currently configured session storage engine. It is essentially a wrapper around a Redigo connection pool.
func New ¶
func New(pool *redis.Pool) *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/garyburd/redigo/redis#Pool.
func (*RedisStore) Delete ¶
func (r *RedisStore) Delete(token string) error
Delete removes a session token and corresponding data from the ResisStore instance.