use Time::HiRes qw/time/;
use Try::Tiny;
use Log::Log4perl qw/get_logger/;
+use LWP::UserAgent;
use constant PAGE_SIZE => 10;
##################################################
+my $ua = LWP::UserAgent->new;
+
sub safe_can_nodie {
my ($type, $sub, $name) = @_;
safe_can_nodie @_ or get_logger->logdie("No such \l$type: '$name'");
}
+sub purge {
+ return unless $ENV{PURGE_HOST};
+ my $req = HTTP::Request->new(PURGE => "http://$ENV{PURGE_HOST}$_[0]");
+ $ua->request($req)
+}
+
sub process{
my $job = shift;
PUBLISH genpage => "$log/@{[$page - 1]}.html";
PUBLISH genpage => "$log/$page.html";
PUBLISH genpage => "$log/@{[$page + 1]}.html";
+
+ purge "/$log/job/$job";
+ purge "/$log/";
+ purge "/$log/st";
+ purge "/$log/$_" for $page - 1, $page, $page + 1;
}
sub got_job{