From 56fabf8adf693913ba60996033de18eb68188a0d Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 19 Nov 2014 18:16:08 +0100 Subject: [PATCH] cache total user count --- apps/user_ldap/user_ldap.php | 5 +++++ 1 file changed, 5 insertions(+) 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; } } -- 2.39.5