Cache file and memory nop 2.65

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I use  Cache file:

- Homepage Products
- Homepage Best Sellers
- Category Navigation
- Homepage Categories
- Manufacturer Navigation

I see improved page load speed. Who got the idea to develop cache file and memory.

For example

1. /Views/Catalog/HomepageProducts.cshtml

@if (Model.AllowCacheHomepageProducts)
{
    <div id="HomepageProducts">
    </div>
    <script type="text/javascript">
        $.get('/Cache/Catalog/HomepageProducts.htm', function (data) {
            $('#HomepageProducts').html(data);
        });
    </script>
}
else
{
......
}

2. /Models/HomePageProductsModel.cs
    public partial class HomePageProductsModel : BaseNopModel
    {
        public HomePageProductsModel()
        {
            Products = new List<ProductOverviewModel>();
        }

        public bool UseSmallProductBox { get; set; }
        public bool AllowCacheHomepageProducts { get; set; }
        public IList<ProductOverviewModel> Products { get; set; }
    }

3. /Controllers/CatalogController.cs

        [ChildActionOnly]
        public ActionResult HomepageProducts(int? productThumbPictureSize)
        {
            var model = new HomePageProductsModel()
            {
                UseSmallProductBox = _catalogSettings.UseSmallProductBoxOnHomePage,
                AllowCacheHomepageProducts = _catalogSettings.AllowCacheHomepageProducts
            };
          ....
        }


demo: http://test265.rstyle.vn/
11 years ago
I have split to asynchronously load Homepage, Detail product and Detalt Category.
11 years ago
Why not use:

[OutputCache( Duration = 3600 , VaryByParam = "productThumbPictureSize" )]
public ActionResult HomepageProducts(int? productThumbPictureSize)
{
}
11 years ago
What keesjan said is a better way of doing Caching.  However, do mindful of the number of customers you will have on your site.  The more customers online, the more memory chewed up.  It adds up over time is all I am pointing out.  If it's just a few people, no worries, however, if it ends up like in the thousands, you may want to be a little more careful on how long you cache or how much.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.