From dad6ade3f9c11592d93e01285b0bf6b441da3d39 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 29 Jan 2024 17:00:06 +0200 Subject: [PATCH] * API: no more session based cache for account list or searches for SQL backend (only for LDAP or AD) --- api/src/Accounts.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/src/Accounts.php b/api/src/Accounts.php index 5c418a37c9..6445cb5a31 100644 --- a/api/src/Accounts.php +++ b/api/src/Accounts.php @@ -22,14 +22,14 @@ use EGroupware\Api\Exception\AssertionFailed; /** * API - accounts * - * This class uses a backend class (at them moment SQL or LDAP) and implements some - * caching on to top of the backend functions: + * This class uses a backend class and implements some caching on to top of the backend functions: * * a) instance-wide account-data cache queried by account_id including also members(hips) * implemented by self::cache_read($account_id) and self::cache_invalidate($account_ids) * * b) session based cache for search, split_accounts and name2id * implemented by self::setup_cache() and self::cache_invalidate() + * SQL backend does NOT use the session, but just a static variable so caching on request base. * * The backend only implements the read, save, delete, name2id and the {set_}members{hips} methods. * The account class implements all other (eg. name2id, id2name) functions on top of these. @@ -39,7 +39,7 @@ use EGroupware\Api\Exception\AssertionFailed; class Accounts { /** - * Enables the session-cache, currently switched on independent of the backend + * Enables the session-cache, currently __construct switches it off for SQL backend * * @var boolean */ @@ -169,6 +169,9 @@ class Accounts } $backend_class = 'EGroupware\\Api\\Accounts\\'.ucfirst($backend); + // switch session cache off for SQL + self::$use_session_cache = $backend !== 'sql'; + if ($backend_object && !is_a($backend_object, $backend_class)) { throw new AssertionFailed("Invalid backend object, not a $backend_class object!");