Conversation
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
| } | ||
|
|
||
| private function getCacheForAccount(int $accountId): ICache { | ||
| return $this->cacheFactory->createDistributed('mail_account_' . $accountId); |
There was a problem hiding this comment.
Missing check for cache availability?
There was a problem hiding this comment.
The check for cache availability is not missing. createDistributed might return a null cache instance; that's fine and we just go ahead and fetch the part.
What is the improvement? |
For "html" messages, we know that there will be another http request for the iframe. As we already have the HTML body, it's a shortcut to store it in the cache, saving us one imap request. Fetching the data from the distributed cache should be, in most cases, faster than talking to the imap server and parsing that response. |
|
Okay, got it. Cache is definitely faster than IMAP 👍 As usual I would just consider the local cache due to lower latency. |
|
/backport to stable5.6 |
Should help with #10384
For HTML messages we already know that after the "body" request there is also an "html" request which also needs the body part, so keeping them in cache makes it a bit faster.
I went with distributed because even in these cases I would expect a small improvement. We skip the usual IMAP handshake and just fetch what we need.