redisdb

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: MIT Imports: 8 Imported by: 1

README

redis

Run CI Lint Run Testing

Redis as backend for Queue package

Setup

start the redis server

redis-server

screen

Testing

go test -v ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Worker)

Option for queue system

func WithAddr

func WithAddr(addr string) Option

WithAddr setup the addr of redis

func WithChannel

func WithChannel(channel string) Option

WithChannel setup the channel of redis

func WithChannelSize

func WithChannelSize(size int) Option

WithChannelSize redis channel size

func WithConnectionString

func WithConnectionString(connectionString string) Option

WithConnectionString redis connection string

func WithDB

func WithDB(db int) Option

WithPassword redis password

func WithLogger

func WithLogger(l queue.Logger) Option

WithLogger set custom logger

func WithPassword

func WithPassword(passwd string) Option

WithPassword redis password

func WithRunFunc

func WithRunFunc(fn func(context.Context, queue.QueuedMessage) error) Option

WithRunFunc setup the run func of queue

type Worker

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

Worker for Redis

func NewWorker

func NewWorker(opts ...Option) *Worker

NewWorker for struc

func (*Worker) AfterRun

func (s *Worker) AfterRun() error

AfterRun run script after start worker

func (*Worker) BeforeRun

func (s *Worker) BeforeRun() error

BeforeRun run script before start worker

func (*Worker) Capacity

func (s *Worker) Capacity() int

Capacity for channel

func (*Worker) Queue

func (s *Worker) Queue(job queue.QueuedMessage) error

Queue send notification to queue

func (*Worker) Run

func (s *Worker) Run() error

Run start the worker

func (*Worker) Shutdown

func (s *Worker) Shutdown() error

Shutdown worker

func (*Worker) Usage

func (s *Worker) Usage() int

Usage for count of channel usage

Jump to

Keyboard shortcuts

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