8

An answer from November 2011 by Darin Dimitrov, a high-reputation member of Stack Overflow, claims that, emphasis mine:

HttpRuntime.Cache is much more than a simple dictionary. It offers thread-safety and cache expiration policies. It provides possibilities of using custom implementation and benefit from distributed caching which is helpful in web farms.

On the other hand, a few other questions more specific about distributed caching indicate that HttpRuntime.Cache is not the right choice:

As I understand it from what I recall about .NET caching when using it a few years ago, HttpRuntime.Cache can be coupled with different implementations of actual caching: in-memory caching, but also any custom provider, such as a one for Redis. This is probably done at configuration level so that the actual code which uses HttpRuntime.Cache wouldn't bother about the location where cached data is stored and the way it is stored (and one could switch from provider to another without modifying the source code).

If this is true, I imagine that this pushed Darin Dimitrov in his original answer to suggest HttpRuntime.Cache as a solution for distributed caching. Since then, no actual implementations of distributed caching providers were made by Microsoft or third-parties, so HttpRuntime.Cache appeared less and less interesting.

Is my understanding correct?

Community
  • 1
  • 1
Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199
  • This is a very good pulling-together of some hard to track down info. I'd mark the question _as_ the answer if I could. – mlhDev Jan 13 '16 at 18:31

0 Answers0