]> iEval git - plack-app-gruntmaster.git/blobdiff - lib/Gruntmaster/Page/Base.pm
Merge cache-control changes from master
[plack-app-gruntmaster.git] / lib / Gruntmaster / Page / Base.pm
index 451d15d4396eaf85b46af4c4ee2e647bbe48a2b0..ee8a3101768148125a468ce5bb71f55d5348ad4c 100644 (file)
@@ -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]");
@@ -44,7 +44,7 @@ sub import {
 my %orig_header_templates = (
   en => <<'HTML',
 <!DOCTYPE html>
-<title>TITLE_GOES_HERE</title>
+<title>TITLE_GOES_HERE | MindCoding</title>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
@@ -86,7 +86,7 @@ my %orig_header_templates = (
 
 <div class="logo logo-mindcoding center-block"></div>
 
-<h1 id="title">TITLE_GOES_HERE | MindCoding</h1>
+<h1 id="title">TITLE_GOES_HERE</h1>
 <div id="result"></div>
 
 <div id="content">
@@ -176,11 +176,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 ]
 }
This page took 0.030241 seconds and 4 git commands to generate.