[Pkg-owncloud-commits] [owncloud] 19/121: Memcache\Factory: Remove static, use globalPrefix.
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 16:44:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit cc1d95cbe5e97b8ca176646a8e74e570c6cd942a
Author: Andreas Fischer <bantu at owncloud.com>
Date: Tue Jul 29 11:14:36 2014 +0200
Memcache\Factory: Remove static, use globalPrefix.
---
lib/base.php | 13 +++++++++++--
lib/private/memcache/factory.php | 5 +++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/base.php b/lib/base.php
index 407f1a6..240ac6c 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -475,9 +475,18 @@ class OC {
self::handleAuthHeaders();
self::initPaths();
- if (OC_Config::getValue('instanceid', false)) {
+
+ // The class loader takes an optional low-latency cache, which MUST be
+ // namespaced. The instanceid is used for namespacing, but might be
+ // unavailable at this point. Futhermore, it might not be possible to
+ // generate an instanceid via \OC_Util::getInstanceId() because the
+ // config file may not be writable. As such, we only register a class
+ // loader cache if instanceid is available without trying to create one.
+ $instanceId = OC_Config::getValue('instanceid', null);
+ if ($instanceId) {
try {
- self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
+ $memcacheFactory = new \OC\Memcache\Factory($instanceId);
+ self::$loader->setMemoryCache($memcacheFactory->createLowLatency('Autoloader'));
} catch (\Exception $ex) {
}
}
diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php
index d60b157..8e47a88 100644
--- a/lib/private/memcache/factory.php
+++ b/lib/private/memcache/factory.php
@@ -59,7 +59,8 @@ class Factory implements ICacheFactory {
* @param string $prefix
* @return null|Cache
*/
- public static function createLowLatency($prefix = '') {
+ public function createLowLatency($prefix = '') {
+ $prefix = $this->globalPrefix . '/' . $prefix;
if (XCache::isAvailable()) {
return new XCache($prefix);
} elseif (APCu::isAvailable()) {
@@ -76,7 +77,7 @@ class Factory implements ICacheFactory {
*
* @return bool
*/
- public static function isAvailableLowLatency() {
+ public function isAvailableLowLatency() {
return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list