redis

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package redis for session provider

depend on github.com/redis/go-redis/v9

go install github.com/redis/go-redis/v9

Usage: import(

_ "gitcode.com/xiayang/faygo/session/redis"
"gitcode.com/xiayang/faygo/session"

)

func init() {
	globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``)
	go globalSessions.GC()
}

more docs: https://gitcode.com/xiayang/faygo

Index

Constants

This section is empty.

Variables

View Source
var MaxPoolSize = 100

MaxPoolSize redis max pool size

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider redis session provider

func (*Provider) SessionAll

func (rp *Provider) SessionAll() int

SessionAll return all activeSession

func (*Provider) SessionDestroy

func (rp *Provider) SessionDestroy(sid string) error

SessionDestroy delete redis session by id

func (*Provider) SessionExist

func (rp *Provider) SessionExist(sid string) bool

SessionExist check redis session exist by sid

func (*Provider) SessionGC

func (rp *Provider) SessionGC()

SessionGC Impelment method, no used.

func (*Provider) SessionInit

func (rp *Provider) SessionInit(maxlifetime int64, savePath string) error

SessionInit init redis session savepath like redis server addr,pool size,password,dbnum e.g. 127.0.0.1:6379,100,astaxie,0

func (*Provider) SessionRead

func (rp *Provider) SessionRead(sid string) (session.Store, error)

SessionRead read redis session by sid

func (*Provider) SessionRegenerate

func (rp *Provider) SessionRegenerate(oldsid, sid string) (session.Store, error)

SessionRegenerate generate new sid for redis session

type SessionStore

type SessionStore struct {
	// contains filtered or unexported fields
}

SessionStore redis session store

func (*SessionStore) Delete

func (rs *SessionStore) Delete(key interface{}) error

Delete value in redis session

func (*SessionStore) Flush

func (rs *SessionStore) Flush() error

Flush clear all values in redis session

func (*SessionStore) Get

func (rs *SessionStore) Get(key interface{}) interface{}

Get value in redis session

func (*SessionStore) SessionID

func (rs *SessionStore) SessionID() string

SessionID get redis session id

func (*SessionStore) SessionRelease

func (rs *SessionStore) SessionRelease(w http.ResponseWriter)

SessionRelease save session values to redis

func (*SessionStore) Set

func (rs *SessionStore) Set(key, value interface{}) error

Set value in redis session

Source Files

  • sess_redis.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL