From: Marius Gavrilescu Date: Thu, 13 Feb 2014 16:23:57 +0000 (+0200) Subject: Make contest problem entries more cacheable X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c86e504ed5be25093c1579e736c05dce02901555;p=plack-app-gruntmaster.git Make contest problem entries more cacheable --- diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index 89f8478..9e2d030 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -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 { diff --git a/lib/Gruntmaster/Page/Pb/Entry.pm b/lib/Gruntmaster/Page/Pb/Entry.pm index 3d696a7..9fcefe5 100644 --- a/lib/Gruntmaster/Page/Pb/Entry.pm +++ b/lib/Gruntmaster/Page/Pb/Entry.pm @@ -32,4 +32,7 @@ sub _generate{ $htc->param(statement => problem_statement $id); } +sub vary { 'Authorization' } +sub max_age { 600 } + 1