X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FBase.pm;h=cf7d2291587809652e8636c03d692692161ed4ae;hb=ff57a758b0a8e3389c99b75682c2c5646f47ae99;hp=cf29eacc3c56962148f012739c16bc36b0260aee;hpb=1053baeebc541fc3508aabb6121759bb4a884e23;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index cf29eac..cf7d229 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -31,7 +31,7 @@ sub import { local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; $_[0]->{'psgix.logger'}->({qw/level debug message/ => $_[1]}) }; - *{"${caller}::reply"} = sub { [200, ['Content-Type' => 'text/plain'], [ @_ ] ] }; + *{"${caller}::reply"} = sub { [200, ['Content-Type' => 'text/plain', 'Cache-Control' => 'no-cache'], [ @_ ] ] }; *{"${caller}::purge"} = sub { return unless $ENV{PURGE_HOST}; my $req = HTTP::Request->new(PURGE => "http://$ENV{PURGE_HOST}$_[0]"); @@ -147,11 +147,13 @@ sub generate{ $self->_generate($htc, $lang, @args); my $out = $htc->output; utf8::downgrade($out); - [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1], 'Vary' => 'Accept-Language', 'X-Forever' => 1], [ $out ] ] + [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1], 'Vary' => 'Accept-Language', 'X-Forever' => 1, 'Cache-Control' => 'max-age=' . $self->max_age], [ $out ] ] } sub _generate {} +sub max_age { 60 } + sub variants { [ map { [ $_, 1, 'text/html', undef, undef, $_, undef ]} keys $_[0]->TEMPLATES ] }