sessions

package
v0.0.0-...-10d5746 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "filharmonic:sessions:"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Expiration time.Duration `json:"expiration" default:"604800s"` // 7 days
}

type MemorySessions

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

func NewMemory

func NewMemory() *MemorySessions

func (*MemorySessions) Add

func (memorySessions *MemorySessions) Add(userId int64) (string, error)

func (*MemorySessions) Close

func (memorySessions *MemorySessions) Close() error

func (*MemorySessions) Delete

func (memorySessions *MemorySessions) Delete(sessionToken string) error

func (*MemorySessions) Get

func (memorySessions *MemorySessions) Get(sessionToken string) (int64, error)

func (*MemorySessions) Set

func (memorySessions *MemorySessions) Set(sessionToken string, userId int64) error

type RedisSessions

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

func NewRedis

func NewRedis(config Config, redisClient *redis.Client) *RedisSessions

func (*RedisSessions) Add

func (redisSessions *RedisSessions) Add(userId int64) (string, error)

func (*RedisSessions) Close

func (redisSessions *RedisSessions) Close() error

func (*RedisSessions) Delete

func (redisSessions *RedisSessions) Delete(sessionToken string) error

func (*RedisSessions) Get

func (redisSessions *RedisSessions) Get(sessionToken string) (int64, error)

func (*RedisSessions) Set

func (redisSessions *RedisSessions) Set(sessionToken string, userId int64) error

type Sessions

type Sessions interface {
	Get(sessionToken string) (int64, error)
	Add(userId int64) (string, error)
	Set(sessionToken string, userId int64) error
	Delete(sessionToken string) error
	Close() error
}

Jump to

Keyboard shortcuts

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