scs: github.com/alexedwards/scs/stores/redisstore Index | Files

package redisstore

import "github.com/alexedwards/scs/stores/redisstore"

Package redisstore is a Redis-based session store 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 (github.com/gomodule/redigo/redis).

Index

Package Files

redisstore.go

Variables

var Prefix = "scs:session:"

Prefix controls the Redis key prefix. You should only need to change this if there is a naming clash.

type RedisStore Uses

type RedisStore struct {
    // contains filtered or unexported fields
}

RedisStore represents the currently configured session session store. It is essentially a wrapper around a Redigo connection pool.

func New Uses

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 Uses

func (r *RedisStore) Delete(token string) error

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

func (*RedisStore) Find Uses

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.

func (*RedisStore) Save Uses

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

Save 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.

Package redisstore imports 2 packages (graph). Updated 2018-07-07. Refresh now. Tools for package owners.