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
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
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:-