title: Should I use Data Cache or Output Cache for a complex navigation menu?
body: <p>I am attempting to cache sections of a navigation menu according to different criteria. </p>
  
  <p>For example, news and articles need to be refreshed on a duration basis, whereas login and profile stuff should be cached on a per user basis.</p>
  
  <p>I'm considering 2 options - would anyone be kind enough to enlighten me about the pros / cons of each?  And if possible suggest a better approach to take!</p>
  
  <p><strong>Option 1.</strong> </p>
  
  <p>Simply cache all required html as strings in the Data Cache. Check for user differences manually when required. </p>
  
  <p>I (perhaps incorrectly) imagine that this would be the most work to implement, but also the most efficient way of caching the different sections.  </p>
  
  <p><strong>Option 2.</strong> </p>
  
  <p>Have a NavigationController with different child action for each section of the menu. (We can apply a different outputCacheProfile on each child action as required.)</p>
  
  <p>But this would require us to call a separate RenderAction for each section of the navigation menu.  And I'm worried about this because of a comment on one of Phil Haack's blog posts: </p>
  
  <blockquote>
    <p>[Render Action] is very similar to making another request since we
    need to run through routing to make sure we have the appropriate route
    data and context to call the action method. So each call to
    RenderAction is going to add up.</p>
  </blockquote>
  
  <p>Full post here: <a href="http://haacked.com/archive/2009/11/18/aspnetmvc2-render-action.aspx" rel="noreferrer">http://haacked.com/archive/2009/11/18/aspnetmvc2-render-action.aspx</a> </p>