4

Possible Duplicate:
Performance of system.runtime.caching

I need to cache list of objects (less than 50 objects with 10-20 fields) which caching method is which caching mehod is better.

EnterpriseLibrary Caching or system.runtime.caching

Community
  • 1
  • 1
user1659922
  • 346
  • 4
  • 15

1 Answers1

1

Given that you have a relatively small amount of objects, I would recommend using system.runtime.caching so that you can avoid the overhead of using the EnterpriseLibrary. You could also consider instantiating a ConcurrenctDictionary to store your cached objects - especially if you want to take more control of the lifetime of the objects (expiration policy etc).

If you had been creating a web application I would have recommended that you use System.Web.Caching.Cache rather than System.Runtime.Caching.MemoryCache. We have had issues with System.Runtime.Caching.MemoryCache, see the following SO article for details:-

Community
  • 1
  • 1
Nick Ryan
  • 2,662
  • 1
  • 17
  • 24