Add EmailSyncWorker and enhance IMAP service with caching
Refactored `ReceivedEmailContext` to use `record` for immutability and value-based equality. Added `SyncIntervalSeconds` to `EmailAccountsOptions` for configuring IMAP sync intervals. Introduced `EmailSyncWorker` as a background service for periodic email synchronization. Registered `IMemoryCache` and integrated caching in `LimilabsImapEmailService` to reduce redundant fetch operations. Optimized `FetchEmailByUidAsync` to conditionally handle attachments and improve performance. Refactored logging and improved code readability by adopting modern C# features like `record`, `with` expressions, and `IOptions`. Performed general cleanup and streamlined method implementations.
This commit is contained in:
@@ -50,6 +50,9 @@ public static class DependencyInjection
|
||||
|
||||
// Register Background Workers
|
||||
services.AddHostedService<AsyncInitWorker>();
|
||||
services.AddHostedService<EmailSyncWorker>();
|
||||
|
||||
services.AddMemoryCache();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user