redis

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAddr = errors.New("invalid connecton string: see documentation for valid connection strings")

ErrInvalidAddr indicates that the provided address is not a valid redis connection string

Functions

func Backend

func Backend(_ context.Context, opts ...config.Option) (backend types.Backend, err error)

Backend is a config.BackendInitializer that initializes a new Redis-backed neoq backend

func WithAddr

func WithAddr(addr string) config.Option

WithAddr configures neoq to connect to Redis with the given address

func WithConcurrency

func WithConcurrency(concurrency int) config.Option

WithConcurrency configures the number of workers available to process jobs across all queues

func WithPassword

func WithPassword(password string) config.Option

WithPassword configures neoq to connect to Redis with the given password

func WithShutdownTimeout

func WithShutdownTimeout(timeout time.Duration) config.Option

WithShutdownTimeout specifies the duration to wait to let workers finish their tasks before forcing them to abort durning Shutdown()

If unset or zero, default timeout of 8 seconds is used.

Types

type RedisBackend added in v0.16.0

type RedisBackend struct {
	types.Backend
	// contains filtered or unexported fields
}

RedisBackend is a Redis-backed neoq backend nolint: revive

func (*RedisBackend) Enqueue added in v0.16.0

func (b *RedisBackend) Enqueue(ctx context.Context, job *jobs.Job) (jobID string, err error)

Enqueue queues jobs to be executed asynchronously

func (*RedisBackend) SetLogger added in v0.16.0

func (b *RedisBackend) SetLogger(logger logging.Logger)

SetLogger sets this backend's logger

func (*RedisBackend) Shutdown added in v0.16.0

func (b *RedisBackend) Shutdown(ctx context.Context)

Shutdown halts the worker

func (*RedisBackend) Start added in v0.16.0

func (b *RedisBackend) Start(_ context.Context, queue string, h handler.Handler) (err error)

Start starts processing jobs with the specified queue and handler

func (*RedisBackend) StartCron added in v0.16.0

func (b *RedisBackend) StartCron(ctx context.Context, cronSpec string, h handler.Handler) (err error)

StartCron starts processing jobs with the specified cron schedule and handler

See: https://pkg.go.dev/github.com/robfig/cron?#hdr-CRON_Expression_Format for details on the cron spec format

Jump to

Keyboard shortcuts

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