diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-06-01 21:31:14 +0200 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-06-01 21:36:10 +0200 |
commit | f582521f12f968f152d556ffb6a3fd28916e19bb (patch) | |
tree | 34060ae41d2ab9cb333091257ff286d86f957fae /apps | |
parent | e8e24cbe6c017bcd457e5a229413db167a1770df (diff) | |
download | nextcloud-server-f582521f12f968f152d556ffb6a3fd28916e19bb.tar.gz nextcloud-server-f582521f12f968f152d556ffb6a3fd28916e19bb.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')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 3a0ce72a853..83933a1a6d6 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -33,6 +33,7 @@ namespace OCA\user_ldap; use OCA\user_ldap\lib\Access; use OCA\user_ldap\lib\BackendUtility; +use OC\Cache\CappedMemoryCache; class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { protected $enabled = false; @@ -40,12 +41,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); @@ -54,6 +55,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(); } /** |