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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given that you have a relatively small amount of objects, I would recommend using
system.runtime.cachingso 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.Cacherather thanSystem.Runtime.Caching.MemoryCache. We have had issues withSystem.Runtime.Caching.MemoryCache, see the following SO article for details:-