0

I am building a website using MVC4. I have a set of objects, which are almost static by nature. Should I opt for Application object or Static data or Cache?

Krishna Sarma
  • 1,852
  • 2
  • 29
  • 52

1 Answers1

0

The benefit of Cache is expiration if there are changes. It's much harder to update a static variable or Application. You basically have to recycle the app pool.

I would say Application is left over for backward compatibility with older asp based apps

TGH
  • 38,769
  • 12
  • 102
  • 135
  • I don't think you need to recycle in order to update as per http://msdn.microsoft.com/en-us/library/ms178594(v=vs.100).aspx - concurrency section. and cache requires additional checks for availability. – Krishna Sarma Nov 12 '14 at 01:07
  • Yes you can build a feature to refresh it, but Cache comes with a life cycle built in. – TGH Nov 12 '14 at 01:09