Session Redis Store

    Example

    1. import (
    2. "github.com/lunny/tango"
    3. "github.com/tango-contrib/session"
    4. "github.com/tango-contrib/session-redis"
    5. )
    6. type SessionAction struct {
    7. }
    8. func (a *SessionAction) Get() string {
    9. a.Session.Set("test", "1")
    10. return a.Session.Get("test").(string)
    11. }
    12. o.Use(session.New(session.Options{
    13. Store: redistore.New(redistore.Options{
    14. Host: "127.0.0.1",
    15. DbIndex: 0,
    16. MaxAge: 30 * time.Minute,
    17. }),
    18. }))
    19. o.Get("/", new(SessionAction))