From 88edfcf26c7b4cdbd083dede0834de5cf6f16999 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Wed, 11 Mar 2009 21:25:21 -0400 Subject: [PATCH] added http_cache_forever() --- http.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/http.php b/http.php index b82e3d1..1abd50b 100644 --- a/http.php +++ b/http.php @@ -92,4 +92,11 @@ function redirect($url, $status = '302 Moved Temporarily', $message = '') { exit(); } +# output http headers to allow caching of this page forever +function http_cache_forever($cache_control = 'public') { + header('Last-Modified: '.gmdate('D, d M Y H:i:s', 5025) . ' GMT'); # long time ago + header("Cache-Control: $cache_control"); + header('Expires: ' . gmdate('D, d M Y H:i:s',time()+31536000) . ' GMT'); # rfc 2616 says not to go more than a year in the future +} + ?> -- 1.7.10.4