Session support for tango
Go to file
Lunny Xiao 04f9c7b909
All checks were successful
checks / check and test (push) Successful in 45s
Remove badage of drone
2023-04-20 09:47:19 +08:00
.gitea/workflows Use actions instead of drone 2023-04-20 09:45:01 +08:00
.gitignore bug fixed 2016-05-16 23:10:01 +08:00
generator.go license 2015-04-28 15:44:51 +08:00
go.mod add drone 2019-10-31 23:20:19 +08:00
go.sum add drone 2019-10-31 23:20:19 +08:00
LICENSE license 2015-04-28 15:44:51 +08:00
memorystore.go Session新增Keys方法,返回所有的Keys 2020-11-10 16:02:43 +08:00
README.md Remove badage of drone 2023-04-20 09:47:19 +08:00
session_test.go Session新增Keys方法,返回所有的Keys 2020-11-10 16:02:43 +08:00
session.go Session新增Keys方法,返回所有的Keys 2020-11-10 16:02:43 +08:00
sessions.go migrate to gitea.com/lunny/tango 2019-03-26 15:56:52 +08:00
store.go Session新增Keys方法,返回所有的Keys 2020-11-10 16:02:43 +08:00
tracker.go added HeaderTracker 2016-01-20 17:11:10 +08:00

session

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.