redis store for session
Go to file
Lunny Xiao 54d5e6b68f bug fixed 2016-05-16 23:12:47 +08:00
LICENSE BSD LICENSE 2015-04-28 15:13:36 +08:00
README.md bug fixed 2016-01-20 17:10:25 +08:00
redis_test.go BSD LICENSE 2015-04-28 15:13:36 +08:00
redis.go bug fixed 2016-05-16 23:12:47 +08:00

session-redis Build Status

Session-redis is a store of session middleware for Tango stored session data via redis.

Installation

go get github.com/tango-contrib/session-redis

Simple Example

package main

import (
    "github.com/lunny/tango"
    "github.com/tango-contrib/session"
    "github.com/tango-contrib/session-redis"
)

type SessionAction struct {
    session.Session
}

func (a *SessionAction) Get() string {
    a.Session.Set("test", "1")
    return a.Session.Get("test").(string)
}

func main() {
    o := tango.Classic()
    o.Use(session.New(session.Options{
        Store: redistore.New(redistore.Options{
                Host:    "127.0.0.1",
                DbIndex: 0,
                MaxAge:  30 * time.Minute,
            }),
        }))
    o.Get("/", new(SessionAction))
}

Getting Help

License

This project is under BSD License. See the LICENSE file for the full license text.