JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added http_cache_forever()
authorJason Woofenden <jason283@herkamire.com>
Thu, 12 Mar 2009 01:25:21 +0000 (21:25 -0400)
committerJason Woofenden <jason283@herkamire.com>
Thu, 12 Mar 2009 01:25:21 +0000 (21:25 -0400)
http.php

index b82e3d1..1abd50b 100644 (file)
--- 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
+}
+
 ?>