feat: add CachedService with cached collections and delta

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-10-07 22:02:45 -04:00
parent 4e12d41ee9
commit 852ead324f
10 changed files with 750 additions and 215 deletions
+14 -1
View File
@@ -76,13 +76,26 @@ class MailboxStore
$this->dataStore->selectCollection(self::COLLECTION_NAME)->updateOne(
['sid' => $serviceId, 'name' => $document['name']],
[
'$set' => ['tid' => $tenantId, 'sid' => $serviceId, ...$document],
'$set' => ['tid' => $tenantId, 'sid' => $serviceId, ...$document, 'listedAt' => time()],
'$setOnInsert' => self::STATE_DEFAULTS,
],
['upsert' => true],
);
}
/**
* When the mailbox list of a service was last harmonized (newest listedAt); null when never.
*/
public function listedAt(string $serviceId): ?int
{
$document = $this->dataStore->selectCollection(self::COLLECTION_NAME)->findOne(
['sid' => $serviceId],
['projection' => ['listedAt' => 1], 'sort' => ['listedAt' => -1]],
);
return isset($document['listedAt']) ? (int) $document['listedAt'] : null;
}
/**
* Retrieve the document of a mailbox.
*/