From cae089df91bf2ba9413145dc800d9fa77aab08cb Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Mon, 25 Jun 2012 08:50:13 +0200
Subject: [PATCH] Cache: Create global cache in OC_Cache

---
 lib/cache.php     | 14 ++++++++++++++
 lib/minimizer.php |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/cache.php b/lib/cache.php
index 55d5b064c4..66d1049fb5 100644
--- a/lib/cache.php
+++ b/lib/cache.php
@@ -8,7 +8,21 @@
 
 class OC_Cache {
 	static protected $cache;
+	static protected $global_cache;
 
+	static public function getGlobalCache() {
+		if (!self::$global_cache) {
+			self::$global_cache = new OC_Cache_FileGlobal();
+		}
+		return self::$global_cache;
+	}
+
+	static public function getUserCache() {
+		if (!self::$cache) {
+			self::init();
+		}
+		return self::$cache;
+	}
 	static protected function init() {
 		$fast_cache = null;
 		if (!$fast_cache && function_exists('xcache_set')) {
diff --git a/lib/minimizer.php b/lib/minimizer.php
index e17c114f06..2650c579c1 100644
--- a/lib/minimizer.php
+++ b/lib/minimizer.php
@@ -22,7 +22,7 @@ abstract class OC_Minimizer {
 		OC_Response::setLastModifiedHeader($last_modified);
 
 		$gzout = false;
-		$cache = new OC_Cache_FileGlobal();
+		$cache = OC_Cache::getGlobalCache();
 		if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)){
 			$gzout = $cache->get($cache_key.'.gz');
 			OC_Response::setETagHeader(md5($gzout));
-- 
GitLab