summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/cache.php10
-rw-r--r--lib/cache/apc.php11
-rw-r--r--lib/cache/xcache.php11
3 files changed, 30 insertions, 2 deletions
diff --git a/lib/cache.php b/lib/cache.php
index e6f2beeb306..1f269174fad 100644
--- a/lib/cache.php
+++ b/lib/cache.php
@@ -12,7 +12,17 @@ class OC_Cache {
static public function getGlobalCache() {
if (!self::$global_cache) {
+ $fast_cache = null;
+ if (!$fast_cache && function_exists('xcache_set')) {
+ $fast_cache = new OC_Cache_XCache(true);
+ }
+ if (!$fast_cache && function_exists('apc_store')) {
+ $fast_cache = new OC_Cache_APC(true);
+ }
self::$global_cache = new OC_Cache_FileGlobal();
+ if ($fast_cache) {
+ self::$global_cache = new OC_Cache_Broker($fast_cache, self::$global_cache);
+ }
}
return self::$global_cache;
}
diff --git a/lib/cache/apc.php b/lib/cache/apc.php
index b1ce87f5267..6cf47d0c158 100644
--- a/lib/cache/apc.php
+++ b/lib/cache/apc.php
@@ -7,11 +7,20 @@
*/
class OC_Cache_APC {
+ protected $prefix;
+
+ public function __construct($global = false) {
+ $this->prefix = OC_Util::getInstanceId().'/';
+ if (!$global) {
+ $this->prefix .= OC_User::getUser().'/';
+ }
+ }
+
/**
* entries in APC gets namespaced to prevent collisions between owncloud instances and users
*/
protected function getNameSpace() {
- return OC_Util::getInstanceId().'/'.OC_User::getUser().'/';
+ return $this->prefix;
}
public function get($key) {
diff --git a/lib/cache/xcache.php b/lib/cache/xcache.php
index b57338929e0..bd55cee8f6b 100644
--- a/lib/cache/xcache.php
+++ b/lib/cache/xcache.php
@@ -7,11 +7,20 @@
*/
class OC_Cache_XCache {
+ protected $prefix;
+
+ public function __construct($global = false) {
+ $this->prefix = OC_Util::getInstanceId().'/';
+ if (!$global) {
+ $this->prefix .= OC_User::getUser().'/';
+ }
+ }
+
/**
* entries in XCache gets namespaced to prevent collisions between owncloud instances and users
*/
protected function getNameSpace() {
- return OC_Util::getInstanceId().'/'.OC_User::getUser().'/';
+ return $this->prefix;
}
public function get($key) {