0

There are a number of ready-to-use solutions to lock asp.net/mvc cache for long running calls to backend systems (such as DB or WCF service) to avoid subsequent requests by other users, e.g. What is the best way to lock cache in asp.net?

Could you recommend any solution when a call to the backend system should be done as async call?

Is "locking an await call" feasible at all as some articles (e.g. Why can't I use the 'await' operator within the body of a lock statement?) conclude that "it is an incredibly bad idea"?

Community
  • 1
  • 1
miksh
  • 169
  • 1
  • 3
  • 10
  • Could you please clarify what exactly you're trying to achieve here? – David Pine Dec 17 '15 at 15:48
  • An alternative for in-memory caches is to cache the `Task` itself instead of the result of the task. This is an easy way to ensure multiple calls only result in a single backend call. However, this approach will also cache exceptions as well as results, so you'd have to take that into consideration. – Stephen Cleary Dec 17 '15 at 16:03

0 Answers0