]> iEval git - plack-app-gruntmaster.git/commitdiff
Make contest problem entries more cacheable
authorMarius Gavrilescu <marius@ieval.ro>
Thu, 13 Feb 2014 16:23:57 +0000 (18:23 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Thu, 13 Feb 2014 16:23:57 +0000 (18:23 +0200)
lib/Gruntmaster/Page/Base.pm
lib/Gruntmaster/Page/Pb/Entry.pm

index 89f8478e6c62ce5cfa9c01cd7dd542ed0a66e911..9e2d03034cc5c8550499301beb3a67d6825199e5 100644 (file)
@@ -74,11 +74,14 @@ 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, 'Cache-Control' => 'max-age=' . $self->max_age], [ $out ] ]
+       my $vary = 'Accept-Language, ' . $self->vary;
+       [200, ['Content-Type' => 'text/html', 'Content-Language' => $_[1], 'Vary' => $vary, 'X-Forever' => 1, 'Cache-Control' => 'max-age=' . $self->max_age], [ $out ] ]
 }
 
 sub _generate {}
 
+sub vary {}
+
 sub max_age { 60 }
 
 sub variants {
index 3d696a726e2d2d7b68f0a19dd261a6ed967102dc..9fcefe5ac30e3d65b58e0121441bc5ad47c1892d 100644 (file)
@@ -32,4 +32,7 @@ sub _generate{
        $htc->param(statement => problem_statement $id);
 }
 
+sub vary { 'Authorization' }
+sub max_age { 600 }
+
 1
This page took 0.028097 seconds and 4 git commands to generate.