diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-05-27 10:32:19 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-05-30 10:57:14 +0200 |
commit | dc4fd43f39db79de2201bf428a35a56fc3070eac (patch) | |
tree | 9bb5f4639000d3920d9e905edcd96e81d615e018 /apps/user_ldap/lib/Group_LDAP.php | |
parent | 985063a7e2307ba645e4912c147ac381fa7b6974 (diff) | |
download | nextcloud-server-dc4fd43f39db79de2201bf428a35a56fc3070eac.tar.gz nextcloud-server-dc4fd43f39db79de2201bf428a35a56fc3070eac.zip |
Use a capped memory cache for the user/group cache
For #24403
When upgrading huge installations this can lead to memory problems as
the cache will only grow and grow.
Capping this memory will make sure we don't run out while during normal
operation still basically cache everything.
Diffstat (limited to 'apps/user_ldap/lib/Group_LDAP.php')
-rw-r--r-- | apps/user_ldap/lib/Group_LDAP.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 27bbcfffd69..7c12613f34d 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -36,6 +36,7 @@ namespace OCA\User_LDAP; +use OC\Cache\CappedMemoryCache; class Group_LDAP extends BackendUtility implements \OCP\GroupInterface { protected $enabled = false; @@ -43,12 +44,12 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface { /** * @var string[] $cachedGroupMembers array of users with gid as key */ - protected $cachedGroupMembers = array(); + protected $cachedGroupMembers; /** * @var string[] $cachedGroupsByMember array of groups with uid as key */ - protected $cachedGroupsByMember = array(); + protected $cachedGroupsByMember; public function __construct(Access $access) { parent::__construct($access); @@ -57,6 +58,9 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface { if(!empty($filter) && !empty($gassoc)) { $this->enabled = true; } + + $this->cachedGroupMembers = new CappedMemoryCache(); + $this->cachedGroupsByMember = new CappedMemoryCache(); } /** |