From 5ba6fe29835f27b1fd3740f252ece47e97fb1dd4 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 3 May 2016 09:29:22 +0200 Subject: [PATCH] Use a CappedCache in the user database backend When running with a user database backend on large installations the cache can grow to significant sizes. This can be especially problematic when running big cron/repair jobs. --- lib/private/user/database.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 22a05090b9..fd273055ae 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -48,11 +48,21 @@ * */ +use OC\Cache\CappedMemoryCache; + /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) */ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend { - private $cache = array(); + /** @var CappedMemoryCache */ + private $cache; + + /** + * OC_User_Database constructor. + */ + public function __construct() { + $this->cache = new CappedMemoryCache(); + } /** * Create a new user