redis

package
v0.0.0-...-f204c81 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(config Config) error

Initialize a new Redis client with the given configuration and return any errors we may encounter along the way

Types

type Config

type Config struct {
	Host     string
	Port     int
	Password string
	DB       int
}

struct for the config object

type Session

type Session struct {
	UserId    string    `json:"userId"`
	CreatedAt time.Time `json:"createdAt"`
	ExpiresAt time.Time `json:"expiresAt"`
}

Struct to represent a session stored in Redis

type SessionManager

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

struct for SessionManagement through redis

func GetConnection

func GetConnection() (*SessionManager, error)

Get a connection to Redis' SessionManager

func (*SessionManager) CreateSession

func (sm *SessionManager) CreateSession(sessionId string, userId string, duration time.Duration) (*Session, error)

Create a new session in redis!

func (*SessionManager) DeleteSession

func (sm *SessionManager) DeleteSession(sessionId string) error

Remove a session from Redis useful if we need to somehow log everyone out!

func (*SessionManager) ExtendSession

func (sm *SessionManager) ExtendSession(sessionId string, duration time.Duration) error

Extend a session in Redis

func (*SessionManager) GetSession

func (sm *SessionManager) GetSession(sessionId string) (*Session, error)

Retrieve a session from Redis

Jump to

Keyboard shortcuts

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