redisqueue

package
v0.0.0-...-dbefbc8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Priority_Lowest = iota
	Priority_Low    = iota
	Priority_Normal = iota
	Priority_High   = iota
	Priority_Urgent = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisQueue

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

RedisQueue operation queue to CCP APIs

func NewRedisQueue

func NewRedisQueue(r *redis.Pool, key string) *RedisQueue

NewRedisQueue creates a new work queue with an existing redigo pool and key name.

func (*RedisQueue) CheckWorkCompleted

func (hq *RedisQueue) CheckWorkCompleted(key string, id interface{}) bool

CheckWorkCompleted takes a key and checks if the ID has been completed to prevent duplicates

func (*RedisQueue) CheckWorkCompletedInBulk

func (hq *RedisQueue) CheckWorkCompletedInBulk(key string, id []int64) ([]bool, error)

CheckWorkCompletedInBulk takes a key and checks if the list of IDs has completed

func (*RedisQueue) CheckWorkExpired

func (hq *RedisQueue) CheckWorkExpired(key string, id interface{}) bool

CheckWorkExpired takes a key and checks if the ID has expired

func (*RedisQueue) CheckWorkExpiredInBulk

func (hq *RedisQueue) CheckWorkExpiredInBulk(key string, id []int64) ([]bool, error)

CheckWorkExpiredInBulk takes a key and checks if the list of IDs has expired

func (*RedisQueue) GetCache

func (hq *RedisQueue) GetCache(key string, id int32) (string, error)

GetCache takes a key and gets the string for the ID

func (*RedisQueue) GetCacheInBulk

func (hq *RedisQueue) GetCacheInBulk(key string, id []int32) ([]string, error)

GetCacheInBulk takes a key and checks if the list of IDs has expired

func (*RedisQueue) GetWork

func (hq *RedisQueue) GetWork() (*Work, error)

GetWork retreives items from the queue

func (*RedisQueue) QueueWork

func (hq *RedisQueue) QueueWork(work []Work, priority int) error

QueueWork adds work to the queue

func (*RedisQueue) ScaledSize

func (hq *RedisQueue) ScaledSize() (int, error)

ScaledSize returns number of elements in the queue scaled by priority

func (*RedisQueue) SetCache

func (hq *RedisQueue) SetCache(key string, id int32, value string) error

SetCache takes a key and sets the string for the ID

func (*RedisQueue) SetCacheInBulk

func (hq *RedisQueue) SetCacheInBulk(key string, ids []int32, strings []string) error

SetCacheInBulk takes keys and sets the strings for the ID

func (*RedisQueue) SetWorkCompleted

func (hq *RedisQueue) SetWorkCompleted(key string, id interface{}) error

SetWorkCompleted takes a key and sets if the ID has been completed to prevent duplicates

func (*RedisQueue) SetWorkCompletedInBulk

func (hq *RedisQueue) SetWorkCompletedInBulk(key string, ids []int64) error

SetWorkCompleted takes a key and sets if the ID has been completed to prevent duplicates

func (*RedisQueue) SetWorkExpire

func (hq *RedisQueue) SetWorkExpire(key string, id interface{}, seconds int) error

SetWorkExpire takes a key and sets if the ID has failed to prevent multiple failed

func (*RedisQueue) Size

func (hq *RedisQueue) Size() (int, error)

Size returns number of elements in the queue

type Work

type Work struct {
	Operation string      `json:"operation"`
	Parameter interface{} `json:"parameters"`
}

Work to be performed

Jump to

Keyboard shortcuts

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