queue

package
v0.0.0-...-d614328 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 2 Imported by: 4

Documentation

Overview

Package queue implements various types of interfaces.Queuer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

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

Redis implements a Redis queue using the LIST datastructure

func NewRedis

func NewRedis(endpoint string, database int, popTimeout int) (*Redis, error)

NewRedis creates a new instance of a Redis queue endpoint is the full URL of the Redis endpoint database is the Redis database number to use popTimeout is the time a BLPOP call will wait before continuing

func (*Redis) Connect

func (queue *Redis) Connect() error

Connect to a Redis instance

func (*Redis) CountItems

func (queue *Redis) CountItems(key string) (int, error)

CountItems counts the amount of items in the given queue

func (*Redis) Disconnect

func (queue *Redis) Disconnect() error

Disconnect from a Redis instance

func (*Redis) Fetch

func (queue *Redis) Fetch(key string) ([]byte, error)

Fetch retrieves a single item from the queue at key and returns a byte slice of data

func (*Redis) FetchMany

func (queue *Redis) FetchMany(key string, count int) ([][]byte, error)

FetchMany retrieves up to the specified count from the queue at key and returns a slive of byte slices

func (*Redis) Purge

func (queue *Redis) Purge(key string) error

Purge all items from the given queue

func (*Redis) Push

func (queue *Redis) Push(key string, data []byte) error

Push pushes data onto the queue at key

func (*Redis) PushMany

func (queue *Redis) PushMany(key string, data [][]byte) error

PushMany pushes multiple items onto the queue at key

Jump to

Keyboard shortcuts

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