From 2016e9bc2f6782279be2031b07e6731f9e9e66c4 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 19 Jan 2026 13:14:26 +0200 Subject: [PATCH] Update XList parameters: remove 'cache' and adjust 'ttl' default value to 0, reflecting changes in caching logic across tests. --- .../Http/Databases/Collections/Documents/XList.php | 7 +++---- .../Databases/Http/TablesDB/Tables/Rows/XList.php | 3 +-- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 9 +++------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index e79735e73a..e0e9bef88d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -71,8 +71,7 @@ class XList extends Action ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->param('transactionId', null, new Nullable(new UID()), 'Transaction ID to read uncommitted changes within the transaction.', true) ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) - ->param('cache', false, new Boolean(true), 'Opt-in to cached responses for select queries. Disabled by default.', true) - ->param('ttl', 30, new Range(min: 1, max: 86400), 'TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 1 and 86400 (24 hours).', true) + ->param('ttl', 0, new Range(min: 0, max: 86400), 'TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 1 and 86400 (24 hours).', true) ->inject('response') ->inject('dbForProject') ->inject('user') @@ -82,7 +81,7 @@ class XList extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $queries, ?string $transactionId, bool $includeTotal, bool $cache, int $ttl, UtopiaResponse $response, Database $dbForProject, Document $user, StatsUsage $queueForStatsUsage, TransactionState $transactionState, Authorization $authorization): void + public function action(string $databaseId, string $collectionId, array $queries, ?string $transactionId, bool $includeTotal, int $ttl, UtopiaResponse $response, Database $dbForProject, Document $user, StatsUsage $queueForStatsUsage, TransactionState $transactionState, Authorization $authorization): void { $isAPIKey = User::isApp($authorization->getRoles()); $isPrivilegedUser = User::isPrivileged($authorization->getRoles()); @@ -140,7 +139,7 @@ class XList extends Action $total = $includeTotal ? $transactionState->countDocuments($collectionTableId, $transactionId, $queries) : 0; } elseif (! empty($selectQueries)) { - if ($cache) { + if ((int)$ttl > 0) { $serializedQueries = []; foreach ($queries as $query) { $serializedQueries[] = $query instanceof Query ? $query->toArray() : $query; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php index dec8c77b37..4b83b3d8a6 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php @@ -56,8 +56,7 @@ class XList extends DocumentXList ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->param('transactionId', null, new Nullable(new UID()), 'Transaction ID to read uncommitted changes within the transaction.', true) ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) - ->param('cache', false, new Boolean(true), 'Opt-in to cached responses for select queries. Disabled by default.', true) - ->param('ttl', 30, new Range(min: 1, max: 86400), 'TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 1 and 86400 (24 hours).', true) + ->param('ttl', 0, new Range(min: 0, max: 86400), 'TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 1 and 86400 (24 hours).', true) ->inject('response') ->inject('dbForProject') ->inject('user') diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index a321161d48..40a781f425 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -2388,7 +2388,6 @@ trait DatabasesBase Query::select(['title', 'releaseYear', '$id'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => true, 'ttl' => 30, ]); @@ -2414,7 +2413,6 @@ trait DatabasesBase Query::select(['title', 'releaseYear', '$id'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => true, 'ttl' => 30, ]); @@ -2438,7 +2436,7 @@ trait DatabasesBase Query::select(['title', 'releaseYear', '$id'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => true, + 'ttl' => 30, 'total' => false, ]); @@ -2464,7 +2462,7 @@ trait DatabasesBase Query::select(['title'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => true, + 'ttl' => 30, ]); $this->assertEquals(200, $documents4['headers']['status-code']); @@ -2488,7 +2486,6 @@ trait DatabasesBase Query::select(['title', 'releaseYear', '$id'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => false, ]); $this->assertEquals(200, $documents5['headers']['status-code']); @@ -2508,7 +2505,7 @@ trait DatabasesBase Query::select(['title', 'releaseYear', '$id'])->toString(), Query::orderAsc('releaseYear')->toString(), ], - 'cache' => true, + 'ttl' => 30, ]); $this->assertEquals(200, $documents6['headers']['status-code']);