Update XList parameters: remove 'cache' and adjust 'ttl' default value to 0, reflecting changes in caching logic across tests.

This commit is contained in:
shimon
2026-01-19 13:14:26 +02:00
parent b3d1410ca9
commit 2016e9bc2f
3 changed files with 7 additions and 12 deletions
@@ -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;
@@ -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')
@@ -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']);