hash the path used for the cache key to prevent key length problems

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-01-24 11:18:05 +01:00
parent e38a978623
commit cbc18b7c8b
No known key found for this signature in database
GPG Key ID: 50F2B59C6DEBBCFE
1 changed files with 3 additions and 2 deletions

View File

@ -541,7 +541,8 @@ class OC_Helper {
*/ */
public static function getStorageInfo($path, $rootInfo = null) { public static function getStorageInfo($path, $rootInfo = null) {
$memcache = \OC::$server->getMemCacheFactory()->create('storageInfo'); $memcache = \OC::$server->getMemCacheFactory()->create('storageInfo');
$cached = $memcache->get($rootInfo ? '__root__' : $path); $cacheKey = $rootInfo ? '__root__' . md5($path) : md5($path);
$cached = $memcache->get($cacheKey);
if (is_array($cached)) { if (is_array($cached)) {
return $cached; return $cached;
} }
@ -613,7 +614,7 @@ class OC_Helper {
$ownerDisplayName = $owner->getDisplayName(); $ownerDisplayName = $owner->getDisplayName();
} }
$memcache->set($rootInfo ? '__root__' : $path, [ $memcache->set($cacheKey, [
'free' => $free, 'free' => $free,
'used' => $used, 'used' => $used,
'quota' => $quota, 'quota' => $quota,