summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-03-17 11:56:00 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-17 12:39:49 +0100
commitc233f2c90b9a27aee715c7d3653763dd5e26d4c9 (patch)
treeb88a8403bbb446a0c7025b5d79044a5c2e5d1245 /lib
parentd96b97043b2fa7ba4d676c1d7b44f4aa5e58c8ee (diff)
downloadnextcloud-server-c233f2c90b9a27aee715c7d3653763dd5e26d4c9.tar.gz
nextcloud-server-c233f2c90b9a27aee715c7d3653763dd5e26d4c9.zip
Add version and path to cache prefix
Prevents to have the cache reused by other instances on the server which have possible the same instance ID and also invalidates older cache entries after an upgrade which can cause unwanted side-effects. Impact for deployment: The same cache will only get used if ownCloud is installed with the same version and under the same path. But this should be a basic requirement anyways.
Diffstat (limited to 'lib')
-rw-r--r--lib/private/memcache/cache.php3
-rw-r--r--lib/private/server.php7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/memcache/cache.php b/lib/private/memcache/cache.php
index c606d94fa51..d2d0353febc 100644
--- a/lib/private/memcache/cache.php
+++ b/lib/private/memcache/cache.php
@@ -21,6 +21,9 @@ abstract class Cache implements \ArrayAccess, \OCP\ICache {
$this->prefix = $prefix;
}
+ /**
+ * @return string Prefix used for caching purposes
+ */
public function getPrefix() {
return $this->prefix;
}
diff --git a/lib/private/server.php b/lib/private/server.php
index 2f688c47f09..6261337e0b1 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -157,8 +157,13 @@ class Server extends SimpleContainer implements IServerContainer {
});
$this->registerService('MemCacheFactory', function ($c) {
$config = $c->getConfig();
+ $v = \OC_App::getAppVersions();
+ $v['core'] = implode('.', \OC_Util::getVersion());
+ $version = implode(',', $v);
$instanceId = \OC_Util::getInstanceId();
- return new \OC\Memcache\Factory($instanceId,
+ $path = \OC::$SERVERROOT;
+ $prefix = md5($instanceId.'-'.$version.'-'.$path);
+ return new \OC\Memcache\Factory($prefix,
$config->getSystemValue('memcache.local', null),
$config->getSystemValue('memcache.distributed', null)
);