Session support for tango
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lunny Xiao b9d4fc3602
add drone
1 month ago
.drone.yml add drone 1 month ago
.gitignore bug fixed 3 years ago
LICENSE license 4 years ago
README.md use go mod & add drone 6 months ago
circle.yml update CI config 2 years ago
generator.go license 4 years ago
go.mod add drone 1 month ago
go.sum add drone 1 month ago
memorystore.go added HeaderTracker 3 years ago
session.go improve the Sessioner and memory usage 2 years ago
session_test.go migrate to gitea.com/lunny/tango 8 months ago
sessions.go migrate to gitea.com/lunny/tango 8 months ago
store.go Revert "Update store.go" 4 years ago
tracker.go added HeaderTracker 3 years ago

README.md

session Build Status

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 gitea.com/tango/session

Simple Example

package main

import (
    "gitea.com/lunny/tango"
    "gitea.com/tango/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.