Refactor IMAP sync caching and improve thread safety
Replaced `IMemoryCache` with a thread-safe `ConcurrentDictionary` for managing IMAP sync dates in `LimilabsImapEmailService`. Added `GetLastImapSyncDate` and `SetLastImapSyncDate` methods to handle cache operations. Updated the `IImapEmailService` interface to include `GetLastImapSyncDate`. Simplified the `MarkAsSeenAsync` method signature for better readability. Introduced a private record type `ImapCacheKey` to encapsulate cache keys.
This commit is contained in:
@@ -29,5 +29,13 @@ public interface IImapEmailService
|
||||
long uid,
|
||||
string folder = "INBOX",
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last IMAP sync date for the specified account and folder.
|
||||
/// </summary>
|
||||
/// <param name="accountId"></param>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
DateTime? GetLastImapSyncDate(int accountId, string folder = "INBOX");
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user