Cache: Create global cache in OC_Cache

This commit is contained in:
Bart Visscher 2012-06-25 08:50:13 +02:00
parent fb53708d10
commit cae089df91
2 changed files with 15 additions and 1 deletions

View File

@ -8,7 +8,21 @@
class OC_Cache { class OC_Cache {
static protected $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() { static protected function init() {
$fast_cache = null; $fast_cache = null;
if (!$fast_cache && function_exists('xcache_set')) { if (!$fast_cache && function_exists('xcache_set')) {

View File

@ -22,7 +22,7 @@ abstract class OC_Minimizer {
OC_Response::setLastModifiedHeader($last_modified); OC_Response::setLastModifiedHeader($last_modified);
$gzout = false; $gzout = false;
$cache = new OC_Cache_FileGlobal(); $cache = OC_Cache::getGlobalCache();
if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)){ if (!OC_Request::isNoCache() && (!defined('DEBUG') || !DEBUG)){
$gzout = $cache->get($cache_key.'.gz'); $gzout = $cache->get($cache_key.'.gz');
OC_Response::setETagHeader(md5($gzout)); OC_Response::setETagHeader(md5($gzout));