redis

package
v0.0.0-...-43541b1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package redis contains postgresql session provider based on go-redis client. Requirements:

redis client https://github.com/redis/go-redis

Index

Constants

View Source
const LOG_PREF = "redis provider:"
View Source
const PROVIDER = "redis"
View Source
const SESS_ID_LEN = 36

Session key ID length.

Variables

View Source
var EKeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type Provider

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

Provider structure holds provider information.

func (*Provider) DestroyAllSessions

func (pder *Provider) DestroyAllSessions(l io.Writer, logLev session.LogLevel)

func (*Provider) GetMaxIdleTime

func (pder *Provider) GetMaxIdleTime() int64

func (*Provider) GetMaxLifeTime

func (pder *Provider) GetMaxLifeTime() int64

func (*Provider) GetSessionIDLen

func (pder *Provider) GetSessionIDLen() int

func (*Provider) InitProvider

func (pder *Provider) InitProvider(provParams []interface{}) error

InitProvider initializes postgresql provider. Function expects two parameters:

0 parameter: Redis url string, redis://<user>:<pass>@localhost:6379/<db>
1 parameter: redis namespace (username)

func (*Provider) SessionClose

func (pder *Provider) SessionClose(sid string) error

SessionClose is a stub

func (*Provider) SessionDestroy

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

SessionDestroy destoys session by its ID.

func (*Provider) SessionGC

func (pder *Provider) SessionGC(l io.Writer, logLev session.LogLevel)

SessionGC removes unused sessions. Handle max idle time only. Max life time is controled by REDIS.

func (*Provider) SessionInit

func (pder *Provider) SessionInit(sid string) (session.Session, error)

SessionInit initializes session with given ID.

func (*Provider) SessionRead

func (pder *Provider) SessionRead(sid string) (session.Session, error)

func (*Provider) SetMaxIdleTime

func (pder *Provider) SetMaxIdleTime(maxIdleTime int64)

func (*Provider) SetMaxLifeTime

func (pder *Provider) SetMaxLifeTime(maxLifeTime int64)

type SessionStore

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

SessionStore contains session id.

func (*SessionStore) Delete

func (st *SessionStore) Delete(key string) error

Delete deletes session value from memmory by key.

func (*SessionStore) Flush

func (st *SessionStore) Flush() error

func (*SessionStore) Get

func (st *SessionStore) Get(key string, val interface{}) error

Get retrieves session value by its key. If there is no key error is returned.

func (*SessionStore) GetBool

func (st *SessionStore) GetBool(key string) bool

GetBool returns bool value by key.

func (*SessionStore) GetDate

func (st *SessionStore) GetDate(key string) time.Time

GetDate returns time.Time value by key.

func (*SessionStore) GetFloat

func (st *SessionStore) GetFloat(key string) float64

GetFloat returns float value by key.

func (*SessionStore) GetInt

func (st *SessionStore) GetInt(key string) int64

GetInt returns int value by key.

func (*SessionStore) GetString

func (st *SessionStore) GetString(key string) string

GetString returns string value by key.

func (*SessionStore) Put

func (st *SessionStore) Put(key string, value interface{}) error

Set sets redis value, updates access time.

func (*SessionStore) SessionID

func (st *SessionStore) SessionID() string

SessionID returns session unique ID.

func (*SessionStore) Set

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

Set sets redis value, updates access time.

func (*SessionStore) TimeAccessed

func (st *SessionStore) TimeAccessed() time.Time

TimeCreated returns timeAccessed property.

func (*SessionStore) TimeCreated

func (st *SessionStore) TimeCreated() time.Time

TimeCreated returns timeCreated property.

Jump to

Keyboard shortcuts

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