ledis store for session
Go to file
2021-10-22 15:05:52 +08:00
.gitignore Implement new method Keys of Session 2020-11-10 16:06:18 +08:00
go.mod Implement new method Keys of Session 2020-11-10 16:06:18 +08:00
go.sum Implement new method Keys of Session 2020-11-10 16:06:18 +08:00
ledis_test.go Implement new method Keys of Session 2020-11-10 16:06:18 +08:00
ledis.go Fix bug 2021-10-22 15:05:52 +08:00
README.md Implement new method Keys of Session 2020-11-10 16:06:18 +08:00

session-ledis Build Status

Session-ledis is a store of session middleware for Tango stored session data via ledis.

Installation

go get gitea.com/tango/session-ledis

Simple Example

package main

import (
    "gitea.com/lunny/tango"
    "gitea.com/tango/session"
    "gitea.com/tango/session-ledis"
)

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{
        Store: redistore.New(ledistore.Options{
                Host:    "127.0.0.1",
                DbIndex: 0,
                MaxAge:  30 * time.Minute,
            }),
        }))
    o.Get("/", new(SessionAction))
}

Getting Help