difference between OutputCache and MemoryCache
Asked Answered
G

0

6

I have a controller action in my asp.net mvc 3 application.

My action consist of a db fetching operation and outputs the result into a view. I can use the OutputCache action filter attribute to store the action result into cache. I can also use the MemoryCache class to store the data of db fetching operation. Both of them will show data from cache. OutputCache will store the whole result into the cache. MemoryCache class will store the db fetch result into cache and the action will fetch data from cache rather than making a new db request for the same result.

My question is which one would be better to apply? I have a felling that OutputCache action filter attribute will work nice as it will store both the db fetch result and action result into cache.

Germano answered 4/11, 2014 at 16:41 Comment(1)
possible duplicate of Caching strategy, Output Cache vs Data Cache or both?Mathewmathews

© 2022 - 2024 — McMap. All rights reserved.