Session to store as ledis local files.
Go to file
yeyuanjie dd846c046f
Some checks failed
checks / check and test (push) Has been cancelled
function Expire change HExpire (#1)
Ledis过期时间函数应该HSet和HExpire配套使用

Reviewed-on: #1
Co-authored-by: yeyuanjie <yecao100@126.com>
Co-committed-by: yeyuanjie <yecao100@126.com>
2024-04-22 09:08:35 +00:00
.gitea/workflows Use actions instead of drone 2023-04-20 09:28:50 +08:00
.gitignore init project 2020-07-19 12:07:07 +08:00
go.mod Implement new method Keys of Session 2020-11-10 16:18:05 +08:00
go.sum Implement new method Keys of Session 2020-11-10 16:18:05 +08:00
ledis_local_test.go Implement new method Keys of Session 2020-11-10 16:18:05 +08:00
ledis_local.go function Expire change HExpire (#1) 2024-04-22 09:08:35 +00:00
LICENSE init project 2020-07-19 12:07:07 +08:00
README.md Fix readme 2020-08-14 11:15:39 +08:00

session-ledis-local Build Status

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

Installation

go get gitea.com/tango/session-ledis-local

Simple Example

package main

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

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()
    store, _ := ledislocal.New(ledislocal.Options{
        Path:    "./ledis_store",
        DBIndex: 0,
        MaxAge:  30 * time.Minute,
    })
    o.Use(session.New(session.Options{
        Store: store,
        }))
    o.Get("/", new(SessionAction))
}

Getting Help