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
5 月之前
.drone.yml add drone 5 月之前
.gitignore bug fixed 3 年之前
LICENSE license 5 年之前
README.md use go mod & add drone 10 月之前
circle.yml update CI config 2 年之前
generator.go license 5 年之前
go.mod add drone 5 月之前
go.sum add drone 5 月之前
memorystore.go added HeaderTracker 4 年之前
session.go improve the Sessioner and memory usage 2 年之前
session_test.go migrate to gitea.com/lunny/tango 1 年之前
sessions.go migrate to gitea.com/lunny/tango 1 年之前
store.go Revert "Update store.go" 4 年之前
tracker.go added HeaderTracker 4 年之前

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.