aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblizzz <blizzz@owncloud.com>2014-12-04 19:08:20 +0100
committerblizzz <blizzz@owncloud.com>2014-12-04 19:08:20 +0100
commit01a176f2a371295ff4c6e7c4645974f80909e670 (patch)
tree2be2694e7be7d56ace0b86f55ca0b03748ca7558
parentaf1c47d1e830e09965582278d5af4cf5ed630ff3 (diff)
parent56fabf8adf693913ba60996033de18eb68188a0d (diff)
downloadnextcloud-server-01a176f2a371295ff4c6e7c4645974f80909e670.tar.gz
nextcloud-server-01a176f2a371295ff4c6e7c4645974f80909e670.zip
Merge pull request #12309 from owncloud/ldap-cache-user-count
LDAP: cache total user count
-rw-r--r--apps/user_ldap/user_ldap.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 6e244311d4a..b7846625d9e 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -292,7 +292,12 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
public function countUsers() {
$filter = \OCP\Util::mb_str_replace(
'%uid', '*', $this->access->connection->ldapLoginFilter, 'UTF-8');
+ $cacheKey = 'countUsers-'.$filter;
+ if(!is_null($entries = $this->access->connection->getFromCache($cacheKey))) {
+ return $entries;
+ }
$entries = $this->access->countUsers($filter);
+ $this->access->connection->writeToCache($cacheKey, $entries);
return $entries;
}
}