summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries/Theme_View.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-28 16:24:51 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-28 16:24:51 -0700
commitaa31e1f0090522c3cfb3a44b947ad8c33a275979 (patch)
tree0438427a2864b69228a48ff6670671d53ee7cf17 /modules/gallery/libraries/Theme_View.php
parentf3f8b5eed6bbb4a1697db2ac5a7085439ed35a0d (diff)
Tweak the cache implementation
1) Drop the *_modified key, we don't really need it. The modification date is not relevant to our browser caching strategy. 2) Fix multiple issues with the Expires header and just hardcode it to the biggest possibly value for code clarity. 3) print the $content out directly instead of using fwrite 4) Minor cleanups in the installer.
Diffstat (limited to 'modules/gallery/libraries/Theme_View.php')
-rw-r--r--modules/gallery/libraries/Theme_View.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index f55cb55a..c3acfeb3 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -172,6 +172,10 @@ class Theme_View_Core extends View {
$this->scripts[$file] = 1;
}
+ /**
+ * Combine a series of Javascript files into a single one and cache it in the database, then
+ * return a single <script> element to refer to it.
+ */
private function _combine_script() {
$links = array();
$key = "";
@@ -188,18 +192,18 @@ class Theme_View_Core extends View {
}
$key = md5($key);
- $contents = Cache::instance()->get($key);
+ $cache = Cache::instance();
+ $contents = $cache->get($key);
if (empty($contents)) {
- $contents = '';
+ $contents = "";
foreach ($links as $link) {
$contents .= file_get_contents($link);
}
- Cache::instance()->set($key, $contents, array("javascript"), 84600);
+ $cache->set($key, $contents, array("javascript"), 30 * 84600);
if (function_exists("gzencode")) {
- Cache::instance()->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP),
- array("javascript", "gzip"), 84600);
+ $cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP),
+ array("javascript", "gzip"), 30 * 84600);
}
- Cache::instance()->set("{$key}_modified", time(), array("javascript", "modified"), 84600);
}
// Handcraft the script link because html::script will add a .js extenstion