LDAP: cache display names immediately on retrieval, saves tens of unecessary queries to LDAP server in the share dialog for example

This commit is contained in:
Arthur Schiwon 2014-04-16 12:56:08 +02:00
parent a4ab29da6e
commit 1c71d5c444
1 changed files with 6 additions and 0 deletions

View File

@ -434,12 +434,18 @@ class Access extends LDAPUtility {
$ocname = $this->dn2ocname($ldapObject['dn'], $nameByLDAP, $isUsers); $ocname = $this->dn2ocname($ldapObject['dn'], $nameByLDAP, $isUsers);
if($ocname) { if($ocname) {
$ownCloudNames[] = $ocname; $ownCloudNames[] = $ocname;
$this->cacheDisplayName($ocname, $nameByLDAP);
} }
continue; continue;
} }
return $ownCloudNames; return $ownCloudNames;
} }
public function cacheDisplayName($uid, $displayName) {
$cacheKeyTrunk = 'getDisplayName';
$this->connection->writeToCache($cacheKeyTrunk.$uid,$displayName);
}
/** /**
* @brief creates a unique name for internal ownCloud use for users. Don't call it directly. * @brief creates a unique name for internal ownCloud use for users. Don't call it directly.
* @param $name the display name of the object * @param $name the display name of the object