redis

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(cfg config.RedisConfig, db int) (*redis.Client, error)

CreateClient from RedisConfig and DB number

Types

type KeyValueService

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

KeyValueService implements userland.KeyValueService interface using redis

func NewKeyValueService

func NewKeyValueService(redisClient *redis.Client) *KeyValueService

NewKeyValueService construct a new KeyValueService from redis client

func (KeyValueService) Delete

func (c KeyValueService) Delete(key string) (err error)

Delete cache in bytes with key without expiration

func (KeyValueService) Get

func (c KeyValueService) Get(key string) (result []byte, err error)

Get a cache in bytes from a key

func (KeyValueService) Set

func (c KeyValueService) Set(key string, value []byte) (err error)

Set cache in bytes with key without expiration

func (KeyValueService) SetEx

func (c KeyValueService) SetEx(key string, value []byte, expiration time.Duration) (err error)

SetEx cache in bytes with key with expiration

type SessionRepository

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

SessionRepository implements userland.SessionRepository interface using redis

func NewSessionRepository

func NewSessionRepository(redisClient *redis.Client) *SessionRepository

NewSessionRepository construct a new SessionRepository from redis client

func (SessionRepository) Create

func (s SessionRepository) Create(userID int, session userland.Session) (err error)

func (SessionRepository) DeleteBySessionID

func (s SessionRepository) DeleteBySessionID(userID int, sessionID string) (err error)

func (SessionRepository) DeleteExpiredSessions

func (s SessionRepository) DeleteExpiredSessions(userID int) (err error)

func (SessionRepository) DeleteOtherSessions

func (s SessionRepository) DeleteOtherSessions(userID int, currentSessionID string) (deletedSessionIDs []string, err error)

func (SessionRepository) FindAllByUserID

func (s SessionRepository) FindAllByUserID(userID int) (userland.Sessions, error)

Jump to

Keyboard shortcuts

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