NAME

Minion::Iterator - Minion iterator

SYNOPSIS

use Minion::Iterator;

my $iter = Minion::Iterator->new(
  minion  => $minion,
  options => {states => ['inactive']},
  what    => 'jobs'
);
while (my $info = $iter->next) {
  say $info->{id};
}

DESCRIPTION

Minion::Iterator is an iterator for Minion listing methods. Note that this module is EXPERIMENTAL and might change without warning!

ATTRIBUTES

Minion::Iterator implements the following attributes.

fetch

my $fetch = $iter->fetch;
$iter     = $iter->fetch(2);

Number of results to cache, defaults to 10.

minion

my $minion = $iter->minion;
$iter      = $iter->minion(Minion->new);

Minion object this job belongs to.

options

my $options = $iter->options;
$iter       = $iter->options({states => ['inactive']});

Options to be passed to "list_jobs" in Minion::Backend or "list_workers" in Minion::Backend.

what

my $what = $iter->what;
$iter    = $iter->what('jobs');

What to "fetch".

METHODS

Minion::Iterator inherits all methods from Mojo::Base and implements the following new ones.

next

my $value = $iter->next;

Get next value.

SEE ALSO

Minion, Mojolicious::Guides, https://mojolicious.org.