redisstore

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: MIT Imports: 3 Imported by: 0

README

scs-redisstore

go-redis based SCS Session store

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 session store. It supports any client that implements redis.Cmdable interface, ex. redis.Client, redis.ClusterClient etc

func New

func New(pool redis.Cmdable) *RedisStore

New returns a new RedisStore instance. The pool parameter should be any redis.Cmdable implementation

func (*RedisStore) Commit added in v0.1.1

func (r *RedisStore) Commit(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.

func (*RedisStore) Delete

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

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

func (*RedisStore) Find

func (r *RedisStore) Find(token string) (b []byte, found 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