job

package
v0.0.0-...-6e5bb36 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IJob

type IJob interface {
	Dispatch(jobName string, secondsFromNow int64, args work.Q)
	Queue(jobName string, args work.Q)
}

IJob ...

func New

func New(opts ...Option) IJob

New ...

type Job

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

Job ...

func (*Job) Dispatch

func (j *Job) Dispatch(jobName string, secondsFromNow int64, args work.Q)

Dispatch ... Make a redis pool

&redis.Pool{
	MaxActive: 5,
	MaxIdle:   5,
	Wait:      true,
	Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", ":6379", redis.DialPassword("powerrangers"))
	},
}

func (*Job) Queue

func (j *Job) Queue(jobName string, args work.Q)

Queue ... Make a redis pool

&redis.Pool{
	MaxActive: 5,
	MaxIdle:   5,
	Wait:      true,
	Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", ":6379", redis.DialPassword("powerrangers"))
	},
}

type Option

type Option func(j *Job)

Option ...

func WithConfig

func WithConfig(config config.IConfig) Option

WithConfig ...

func WithRedis

func WithRedis(redis *redis.Pool) Option

WithRedis ...

Jump to

Keyboard shortcuts

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