Session support for tango
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
circle.yml
generator.go
memorystore.go
session.go
session_test.go
sessions.go
store.go
tracker.go

README.md

session CircleCI

Session is a session middleware for Tango.

Backend Supports

Currently session support some backends below:

  • Memory - memory as a session store, this is the default store
  • nodb - nodb as a session store
  • redis - redis server as a session store
  • ledis - ledis server as a session store
  • ssdb - ssdb server as a session store

Installation

go get github.com/tango-contrib/session

Simple Example

package main

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

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{
        MaxAge:time.Minute * 20,
        }))
    o.Get("/", new(SessionAction))
}

Getting Help

License

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