Dezi-Bot
view release on metacpan or search on metacpan
lib/Dezi/Bot/Queue/DBI.pm view on Meta::CPAN
}
);
}
=head2 get([ I<limit>, I<update_cols> ])
Returns the next item from the queue, marking it as unavailable.
Default is to return 1 item, but set I<limit> to return multiple.
I<update_cols> is an optional hashref of column/value pairs to update
when each item is locked.
=cut
sub get {
my $self = shift;
my $limit = shift || 1;
my $update_cols = shift || {};
my @items;
my $t = $self->{table_name};
$self->{conn}->run(
lib/Dezi/Bot/Queue/DBI.pm view on Meta::CPAN
my $dbh = $_; # just for clarity
$count
= $dbh->do( qq/delete from $t where uri_md5=?/, undef, $md5 );
}
);
return $count;
}
=head2 clean
Remove all locked items from the queue.
=cut
sub clean {
my $self = shift;
my $count = 0;
my $t = $self->{table_name};
$self->{conn}->run(
sub {
my $dbh = $_; # just for clarity
$count = $dbh->do(qq/delete from $t where locked!=0/);
}
);
return $count;
}
=head2 peek([ I<limit> ])
Returns the next item value, but leaves it on the stack as available.
=cut
( run in 0.553 second using v1.01-cache-2.11-cpan-49f99fa48dc )