redis_queue

package module
v0.0.0-...-ef5e85e Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	Key  string
	Conn redis.Conn
}

Queue is a data structure with a Key, which is the name of the Redis endpoint / database name. The structure also contains a connection object that we use to interact with Redis The items in the queue are all stored in Redis so they are not represented in the struct. Currently the queue only accepts strings.

func NewQueue

func NewQueue(uri, key string) (*Queue, error)

New Queue generates a new Redis list with Queue methods.

func (*Queue) Close

func (q *Queue) Close()

Close closes the Redis connection. Using defer q.Close() after you create a new queue is a good idea

func (*Queue) Dequeue

func (q *Queue) Dequeue() (string, error)

Dequeue removes the earliest item added to the queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(item string) error

Enqueue adds a string to the start of the queue

func (*Queue) Length

func (q *Queue) Length() (int, error)

Length provides the amount of items currently in the queue

func (*Queue) Peek

func (q *Queue) Peek() (bool, error)

Peek checks for items in the queue, returning false if the queue is empty or true otherwise

Jump to

Keyboard shortcuts

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