开发者

Application Data Cache - Quartz.NET vs Task list?

I am working on designing an application data cache for a large system in .NET.

The application data cache will be polling from multiple (10+) different systems or databases. It will also required to be refreshed at the certain intervals (30 minutes).

There are two options coming up to me.

The first one is to use Quartz.NET (or other scheduler framework) to trigger the cache builder at certain interval. It seems that I can easily control the intervals in configuration file and the scheduling is very flexible.

The second option is to use Task list, where one or many tasks will be pulling data and building the cache and the last one will be sleeping for a configurable time period. Then I can trigger the task list and let it run until the application close.

Right now, I am more inclined to the second option where I can pass in cancellation token so there will be more control over the start up and shut down process. Also, individual task can be break down to define dependen开发者_开发技巧cies like task hierarchy.

Which way above is better? Is there any better way?


Of the two options you are considering I would recommend a scheduler, because:

  1. It's something you don't have to write and maintain yourself.
  2. Schedulers can persist the schedules, so if the app restarts or you reboot, the scheduler handles it.
  3. The tasks are called jobs in the schedulers (in Quartz.net anyway) and you can set them to run at separate intervals. You can also have one job trigger other jobs.
  4. Schedulers offer programmatic access to schedules and jobs, so you can pause, add or remove jobs as needed.


Well if it is standard Asp.Net and SQL server, explore SQLCacheDependency. Its event based and will be triggered whenever there is a change in the undelying database tables. You dont have to poll the DB everytime.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜