generated from Nodarx/template
feat: add CachedService with cached collections and delta
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user