应用程序数据缓存 - Quartz.NET 与任务列表?
我正在致力于为 .NET 中的大型系统设计应用程序数据缓存。
应用程序数据缓存将从多个(10+)不同的系统或数据库进行轮询。它还需要按一定的时间间隔(30 分钟)刷新。
我有两个选择。
第一个是使用 Quartz.NET(或其他调度程序框架)以一定的时间间隔触发缓存构建器。看来我可以很容易地在配置文件中控制间隔,并且调度非常灵活。
第二种选择是使用任务列表,其中一个或多个任务将提取数据并构建缓存,最后一个任务将休眠一段可配置的时间。然后我可以触发任务列表并让它运行直到应用程序关闭。
现在,我更倾向于第二种选择,我可以传递取消令牌,这样可以更好地控制启动和关闭过程。此外,可以分解单个任务来定义任务层次结构等依赖关系。
上面哪种方式比较好?还有更好的办法吗?
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 dependencies like task hierarchy.
Which way above is better? Is there any better way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您正在考虑的两个选项中,我会推荐一个调度程序,因为:
Of the two options you are considering I would recommend a scheduler, because:
如果是标准的 Asp.Net 和 SQL Server,请探索 SQLCacheDependency。它基于事件,只要基础数据库表发生变化就会被触发。您不必每次都轮询数据库。
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.