Cache ThreadsOldUids based on bThreadSort true/false #1507

This commit is contained in:
the-djmaze 2024-03-25 19:53:04 +01:00
parent c1e25dedb9
commit 7f94c26bee

View file

@ -502,9 +502,11 @@ class MailClient
{ {
$oFolderInfo = $oMessageCollection->FolderInfo; $oFolderInfo = $oMessageCollection->FolderInfo;
$bThreadSort = $this->bThreadSort && $this->oImapClient->hasCapability('SORT');
$sSerializedHashKey = null; $sSerializedHashKey = null;
if ($oCacher && $oCacher->IsInited()) { if ($oCacher && $oCacher->IsInited()) {
$sSerializedHashKey = "ThreadsOldUids/{$oFolderInfo->etag}"; $sSerializedHashKey = "ThreadsOldUids/{$oFolderInfo->etag}/" . ($bThreadSort ? 'S' : 'N');
$sSerializedUids = $oCacher->Get($sSerializedHashKey); $sSerializedUids = $oCacher->Get($sSerializedHashKey);
if (!empty($sSerializedUids)) { if (!empty($sSerializedUids)) {
$aSerializedUids = \json_decode($sSerializedUids, true); $aSerializedUids = \json_decode($sSerializedUids, true);
@ -517,7 +519,7 @@ class MailClient
$aUids = []; $aUids = [];
if ($this->bThreadSort && $this->oImapClient->hasCapability('SORT')) { if ($bThreadSort) {
$oParams = new MessageListParams; $oParams = new MessageListParams;
$oParams->sFolderName = $oFolderInfo->FullName; $oParams->sFolderName = $oFolderInfo->FullName;
$oParams->sSort = 'DATE'; $oParams->sSort = 'DATE';