redis

package
v0.0.0-...-4c750bb Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Host      string
	Port      int
	BatchSize int
	Timeout   time.Duration
	Password  string //consider using vault of osme type of secure way to get it maybe create an interface for this ATM
}

type DBInterface

type DBInterface interface {
	Set(prefix string, key string, value string) error
	HashSet(prefix string, key string, valueMap map[string]interface{}) error
	Get(prefix string, key string) (string, error)
	GetHashSet(prefix string, key string) ([]interface{}, error)
	Exist(prefix string, key string) (bool, error)
	Delete(prefix string, key string) error
	FindHashSets(min int, max int) ([]string, error)
	SetScore(prefix string, key string, score int) error
	UpdateScore(prefix string, key string, score int) error
}

func NewRedisDB

func NewRedisDB(client RedisClientInterface) (DBInterface, error)

type RedisClient

type RedisClient struct {
	Pool      *redis.Pool
	BatchSize int
}

func NewRedisClient

func NewRedisClient(config Configuration) (*RedisClient, error)

func (*RedisClient) Close

func (client *RedisClient) Close() error

func (*RedisClient) GetConnection

func (client *RedisClient) GetConnection() redis.Conn

func (*RedisClient) TestConnection

func (client *RedisClient) TestConnection() (redis.Conn, error)

type RedisClientInterface

type RedisClientInterface interface {
	Close() error
	GetConnection() redis.Conn
	TestConnection() (redis.Conn, error)
}

type RedisDB

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

func (*RedisDB) Delete

func (db *RedisDB) Delete(prefix string, key string) error

func (*RedisDB) Exist

func (db *RedisDB) Exist(prefix string, key string) (bool, error)

func (*RedisDB) FindHashSets

func (db *RedisDB) FindHashSets(min int, max int) ([]string, error)

func (*RedisDB) Get

func (db *RedisDB) Get(prefix string, key string) (string, error)

func (*RedisDB) GetHashSet

func (db *RedisDB) GetHashSet(prefix string, key string) ([]interface{}, error)

func (*RedisDB) HashSet

func (db *RedisDB) HashSet(prefix string, key string, valueMap map[string]interface{}) error

func (*RedisDB) Set

func (db *RedisDB) Set(prefix string, key string, value string) error

func (*RedisDB) SetScore

func (db *RedisDB) SetScore(prefix string, key string, score int) error

func (*RedisDB) UpdateScore

func (db *RedisDB) UpdateScore(prefix string, key string, score int) error

Jump to

Keyboard shortcuts

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