diff options
-rw-r--r-- | lib/private/memcache/cache.php | 2 | ||||
-rw-r--r-- | lib/private/memcache/factory.php | 13 | ||||
-rw-r--r-- | lib/private/server.php | 3 | ||||
-rw-r--r-- | lib/public/iservercontainer.php | 7 |
4 files changed, 23 insertions, 2 deletions
diff --git a/lib/private/memcache/cache.php b/lib/private/memcache/cache.php index 0ad1cc7ec03..03671b3f240 100644 --- a/lib/private/memcache/cache.php +++ b/lib/private/memcache/cache.php @@ -18,7 +18,7 @@ abstract class Cache implements \ArrayAccess { * @param string $prefix */ public function __construct($prefix = '') { - $this->prefix = \OC_Util::getInstanceId() . '/' . $prefix; + $this->prefix = $prefix; } public function getPrefix() { diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php index fde7d947567..48c97b59551 100644 --- a/lib/private/memcache/factory.php +++ b/lib/private/memcache/factory.php @@ -10,12 +10,25 @@ namespace OC\Memcache; class Factory { /** + * @var string $globalPrefix + */ + private $globalPrefix; + + /** + * @param string $globalPrefix + */ + public function __construct($globalPrefix) { + $this->globalPrefix = $globalPrefix; + } + + /** * get a cache instance, will return null if no backend is available * * @param string $prefix * @return \OC\Memcache\Cache */ function create($prefix = '') { + $prefix = $this->globalPrefix . '/' . $prefix; if (XCache::isAvailable()) { return new XCache($prefix); } elseif (APCu::isAvailable()) { diff --git a/lib/private/server.php b/lib/private/server.php index 84ee8cadf04..6b242bddd01 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -137,7 +137,8 @@ class Server extends SimpleContainer implements IServerContainer { return new UserCache(); }); $this->registerService('MemCache', function ($c) { - $factory = new \OC\Memcache\Factory(); + $instanceId = \OC_Util::getInstanceId(); + $factory = new \OC\Memcache\Factory($instanceId); return $factory->create(); }); $this->registerService('ActivityManager', function($c) { diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index b958d2d03f4..7ac5049ef24 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -142,6 +142,13 @@ interface IServerContainer { function getCache(); /** + * Returns an ICache instance + * + * @return \OCP\ICache + */ + function getMemCache(); + + /** * Returns the current session * * @return \OCP\ISession |