[英]How does Hangfire store call backs?
Given this code... 给定此代码...
RecurringJob.AddOrUpdate(
() => Console.WriteLine("Recurring!"),
Cron.Daily);
How does Hangfire store the code to call daily such that it can run it in the future? Hangfire如何存储每天调用的代码,以便将来可以运行?
The short answer is reflection en serialization, but hangfire has a Github repository and I think the most relevant pieces of codes can be found here. 简短的答案是反射序列化,但是hangfire有一个Github存储库,我认为可以在这里找到最相关的代码。 https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/Common/Job.cs
https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/Common/Job.cs
remark from the code 从代码中备注
The ability to serialize an action is the cornerstone of marshalling it outside of a current process boundaries.
序列化操作的能力是将其编组到当前过程边界之外的基础。 We are leaving behind all the tricky features, eg serializing lambdas with their closures or so, and considering a simple method call information as a such an action, and using reflection to perform it.
我们将所有棘手的功能都抛在了后面,例如将lambda与其闭包序列化,并考虑将简单的方法调用信息视为此类操作,并使用反射来执行该操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.