[xiph-commits] r14526 - websites/dir.xiph.org
karl at svn.xiph.org
karl at svn.xiph.org
Mon Feb 18 16:10:59 PST 2008
Author: karl
Date: 2008-02-18 16:10:58 -0800 (Mon, 18 Feb 2008)
New Revision: 14526
Modified:
websites/dir.xiph.org/index.php
Log:
cache page contents as they don't change that often, but skip cached page if a
query is requested. See if the SQL load is any better.
Modified: websites/dir.xiph.org/index.php
===================================================================
--- websites/dir.xiph.org/index.php 2008-02-18 19:50:07 UTC (rev 14525)
+++ websites/dir.xiph.org/index.php 2008-02-19 00:10:58 UTC (rev 14526)
@@ -1,4 +1,17 @@
-<? $nopad = 1; ?>
+<?
+if (empty ($_GET))
+{
+ // 2 minutes of cache time
+ if (file_exists ('/tmp/dir.xiph.org.index_cache.html') && filemtime ('/tmp/dir.xiph.org.index_cache.html') >= (mktime () - 120))
+ {
+ header('X-Using-Cache: yes');
+ readfile ('/tmp/dir.xiph.org.index_cache.html');
+ exit ();
+ }
+ ob_start ();
+}
+$nopad = 1;
+?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
@@ -484,3 +497,14 @@
</table>
</body>
</html>
+
+<?
+if (empty($_GET))
+{
+ $data = ob_get_contents();
+ ob_end_flush();
+ $fp = fopen('/tmp/dir.xiph.org.index_cache.html', 'w');
+ fwrite($fp, $data);
+ fclose($fp);
+}
+?>
More information about the commits
mailing list