Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 825785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:18:39+00:00 2026-05-15T03:18:39+00:00

I have an ecommerce working in ASP.Net MVC. I’m using Caching to improve performance

  • 0

I have an ecommerce working in ASP.Net MVC. I’m using Caching to improve performance in my pages and it’s working.

I’d link to know what offers better performance, for example, I can set OutputCache in my views and and use this cache for all page OR I could get my List of Products in controller, put it on cache (like the code below) and send it to View to render for the user?

private IEnumerable<Products> GetProductsCache(string key, ProductType type)
        {
            if (HttpContext.Cache[key] == null)
                HttpContext.Cache.Insert(key, ProductRepository.GetProducts(type), null, DateTime.Now.AddMinutes(10), Cache.NoSlidingExpiration);

            return (IEnumerable<Products>)HttpContext.Cache[key];
        }

public ActionResult Index()
        {
            var home = new HomeViewModel()
                           {
                               Products = GetProductsCache("ProductHomeCache", ProductType.Product)
                               Services = GetProductsCache("ServiceHomeCache", ProductType.Service)
                           };

            return View(home);
        }

Both work, but I’d like to know what is the preferred method to improve performance, or are there other, better ways to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:18:40+00:00Added an answer on May 15, 2026 at 3:18 am

    In a real ASP.NET MVC site you will hardly have the chance to use OutPutCache.

    The problem is that there is no save way to use donut caching. This means you cache most of the page but have some parts that are user specific that you dont cache. This works in old school ASP.NET.

    Phil Haack wrote about donut caching but it turned out to be not feasible in MVC2
    http://haacked.com/archive/2008/11/05/donut-caching-in-asp.net-mvc.aspx

    Often I started using OutputCaching not thinking about this little user specific detail everybody forgott.

    You might think: I can work around it by doing some Javascript stuff that loads dynamic data…bad idea for a public facing website. There are non javascript clients and there is the google bot.

    First I was frightened that this might bring our high traffic site down: But it works very well by caching the results of calls into the datalayer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on eCommerce app Using Asp.net 3.5 MVC. On my Cart View
I am currently creating an e-commerce site using C# ASP.NET MVC and have just
I have developed a business index which combines ecommerce websites.(in asp.net2.0+c#) I'm looking for
I have an ASP.NET 3.5 e-commerce site that has an admin section. I want
I'm currently working on an C#/ASP.NET project that will host several differents e-commerce websites,
I am currently building an ecommerce site with PHP/MySQL. Recently, I have been working
Have just started using Google Chrome , and noticed in parts of our site,
I have a large .NET web application. The system has projects for different intentions
I am looking at writing an ecommerce platform just for working practice and a
I switched from Intelligencia's UrlRewriter to the new web forms routing in ASP.NET 4.0.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.