redisHelpers

package
v0.0.0-...-48849e1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedisTime

func GetRedisTime(pool ConnGetter) (redisTime time.Time, err error)

GetRedisTime returns the redis server's current timestamp

func GetRequest

func GetRequest(ctx context.Context, pool ConnGetter, logger *log.Logger) (request *protocol.Request, err error)

GetRequest retrieves a hash request from redis. If no requests are currently in the queue, it blocks until one is available.

func PublishResponse

func PublishResponse(res *protocol.Response, responseKey string, pool ConnGetter, logger *log.Logger)

PublishResponse publishes the provided response via redis, including automatic retry and responseKey concatenation with the prefix from the config package.

Types

type ConnGetter

type ConnGetter interface {
	// Get returns a redis connection instance.
	Get() redis.Conn
}

type MockPool

type MockPool struct {
	Conn *redigomock.Conn
}

func NewMockPool

func NewMockPool() (mp *MockPool)

func (*MockPool) Get

func (mp *MockPool) Get() (conn redis.Conn)

Get returns a redis connection instance.

Jump to

Keyboard shortcuts

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