diff --git a/lib/private/memcache/cache.php b/lib/private/memcache/cache.php index 0ad1cc7ec0391025ef11be3296b9aa992375d0fa..03671b3f240102bb0af12033625fed99acae8e83 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 fde7d94756731662ef562099ecbd6bc6836c5b04..48c97b59551b9d51e338f349f31a162735253257 100644 --- a/lib/private/memcache/factory.php +++ b/lib/private/memcache/factory.php @@ -9,6 +9,18 @@ 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 * @@ -16,6 +28,7 @@ class Factory { * @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 84ee8cadf04be2bd8e4b388d9ec338bc21985898..6b242bddd0160c109de11c908d8c3ad4db76c478 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 b958d2d03f40d26471840f7ab0fbe7be81d66a7e..7ac5049ef24240a8a14e0747d791fc62a8a9ee49 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -141,6 +141,13 @@ interface IServerContainer { */ function getCache(); + /** + * Returns an ICache instance + * + * @return \OCP\ICache + */ + function getMemCache(); + /** * Returns the current session *