Documentation
¶
Index ¶
- func DefaultGetSession(ctx *mist.Context) (session.Session, bool)
- func GetSession(ctx *mist.Context, key string) (session.Session, bool)
- type MiddlewareBuilder
- type Option
- func WithAutoGC(enable bool, interval time.Duration) Option
- func WithCookieDomain(domain string) Option
- func WithCookieHTTPOnly(httpOnly bool) Option
- func WithCookieName(name string) Option
- func WithCookiePath(path string) Option
- func WithCookieSameSite(sameSite http.SameSite) Option
- func WithCookieSecure(secure bool) Option
- func WithMaxAge(maxAge int) Option
- func WithSessionKey(key string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultGetSession ¶
DefaultGetSession 使用默认键名获取会话
Types ¶
type MiddlewareBuilder ¶
type MiddlewareBuilder struct {
// contains filtered or unexported fields
}
MiddlewareBuilder 会话中间件构建器
func NewMemoryStore ¶
func NewMemoryStore(opts ...Option) (*MiddlewareBuilder, error)
NewMemoryStore 创建基于内存的会话中间件
func NewRedisStore ¶
func NewRedisStore(addr string, password string, db int, keyPrefix string, opts ...Option) (*MiddlewareBuilder, error)
NewRedisStore 创建基于Redis的会话中间件
func (*MiddlewareBuilder) GetManager ¶ added in v0.1.20
func (b *MiddlewareBuilder) GetManager() *session.Manager
GetManager 获取会话管理器
func (*MiddlewareBuilder) RunGC ¶ added in v0.1.20
func (b *MiddlewareBuilder) RunGC() error
RunGC 手动运行垃圾回收
type Option ¶
type Option func(*MiddlewareBuilder)
Option 会话中间件选项
func WithAutoGC ¶ added in v0.1.20
WithAutoGC 设置是否启用自动垃圾回收
func WithCookieHTTPOnly ¶
WithCookieHTTPOnly 设置cookie是否禁止JavaScript访问
func WithCookieSameSite ¶
WithCookieSameSite 设置cookie的SameSite属性
func WithCookieSecure ¶
WithCookieSecure 设置cookie是否只通过HTTPS发送
Click to show internal directories.
Click to hide internal directories.