From c86e504ed5be25093c1579e736c05dce02901555 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 13 Feb 2014 18:23:57 +0200 Subject: [PATCH] Make contest problem entries more cacheable --- lib/Gruntmaster/Page/Base.pm | 5 ++++- lib/Gruntmaster/Page/Pb/Entry.pm | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 -- 2.39.2