]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cache: Create global cache in OC_Cache
authorBart Visscher <bartv@thisnet.nl>
Mon, 25 Jun 2012 06:50:13 +0000 (08:50 +0200)
committerBart Visscher <bartv@thisnet.nl>
Mon, 25 Jun 2012 19:05:10 +0000 (21:05 +0200)
lib/cache.php
lib/minimizer.php

index 55d5b064c41efe893b8511a47ba18a27949c0264..66d1049fb52c3ffbd909ccc5c8746ea3b2fd2b8f 100644 (file)
@@ -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')) {
index e17c114f0650fa69d257cf425216176c2a9b7887..2650c579c1ddbaa56660aaa6664475f50e4d7e0b 100644 (file)
@@ -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));