diff options
author | blizzz <blizzz@owncloud.com> | 2014-12-04 19:08:20 +0100 |
---|---|---|
committer | blizzz <blizzz@owncloud.com> | 2014-12-04 19:08:20 +0100 |
commit | 01a176f2a371295ff4c6e7c4645974f80909e670 (patch) | |
tree | 2be2694e7be7d56ace0b86f55ca0b03748ca7558 | |
parent | af1c47d1e830e09965582278d5af4cf5ed630ff3 (diff) | |
parent | 56fabf8adf693913ba60996033de18eb68188a0d (diff) | |
download | nextcloud-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.php | 5 |
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; } } |