redistore

package module
v0.0.0-...-dbd50bd Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2013 License: MIT Imports: 7 Imported by: 0

README

redistore

A session store backend for gorilla/sessions

Requirements

Depends on the Redigo Redis library.

Installation

go get github.com/boj/redistore

Documentation

Available on godoc.org

Documentation

Overview

Package redistore is a session store backend for gorilla/sessions

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RediStore

type RediStore struct {
	Pool    *redis.Pool
	Codecs  []securecookie.Codec
	Options *sessions.Options // default configuration
}

RediStore stores sessions in a redis backend.

Example
// RedisStore
store := NewRediStore(10, "tcp", ":6379", "", []byte("secret-key"))
defer store.Close()
Output:

func NewRediStore

func NewRediStore(size int, network, address, password string, keyPairs ...[]byte) *RediStore

NewRediStore returns a new RediStore.

func (*RediStore) Close

func (s *RediStore) Close()

Close cleans up the redis connections.

func (*RediStore) Delete

func (s *RediStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

Delete removes the session from redis, and sets the cookie to expire.

func (*RediStore) Get

func (s *RediStore) Get(r *http.Request, name string) (*sessions.Session, error)

Get returns a session for the given name after adding it to the registry.

See gorilla/sessions FilesystemStore.Get().

func (*RediStore) New

func (s *RediStore) New(r *http.Request, name string) (*sessions.Session, error)

New returns a session for the given name without adding it to the registry.

See gorilla/sessions FilesystemStore.New().

func (*RediStore) Save

func (s *RediStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

Save adds a single session to the response.

Jump to

Keyboard shortcuts

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