I have a console application in task scheduler that runs every 1 minute for 12 hours. It performs the following steps:
Starts and connect to a mailbox using POP3 and gets list of all emails.
For every new email, it queries SQL DB to check if email id exists in table.
If email id exists in table, it performs it actions and move to next email id in queue.
This action continues for every 1 minute for 12 hours.
My questions are:
For step no 2 - is there any alternative instead of hitting db every 1 minute for every new email id. I thought of caching the table data and then check in cache for matching records, but the table contains 10k rows which I believe is heavy for cache.
Is there any other way to keep a watch on my inbox, if a new email appears I can trigger the action instead of console application in task scheduler that runs every 1 minute.