Search code examples
asp.netcachinghangfire

Add ang get data from cache from HangFire


I am trying to use Hangfire to update some lists in the cache (HttpContext.Current.Cache). I get a NullReferenceException because HttpContext is null when Hangfire is calling it.

Is there any way to use Hangfire for this or maybe I shall look for another framework?


Solution

  • You can not execute changing context like HttpContext inside Hangfire because Hangfire can run jobs in different server and machine. If you want to access changing context like HttpContext probably you need to have at least share storage to do that and dkempner has proposal for this scenario but didn't happen till now.