NopCommerce navigation menu HTML static processing to improve performance

Source: Internet
Author: User

Because the website needs to be quickly launched, sometimes NopCommerce performance problems have always been the biggest problem for us. It is one of the methods to find out some code to be optimized for modification and reconstruction, I am waiting for non-mainstream optimization methods only to quickly improve the overall performance of the program.

Take the navigation menu as an example to list the methods we optimized in development.

Code segment for introducing a view in MVC:

@ Html. Action ("Menu", "Common ")

When we get data and find that the running speed is too slow, we want to give the content to the static cache and the following code is available:

OutHtml = (! File. exists (Server. mapPath (content = Html. action (, (StreamWriter writer = StreamWriter (Server. mapPath (), outHtml = (StreamReader sr = StreamReader (Server. mapPath (outHtml = @ Html. raw (outHtml)

When we modify the content of the relevant category, we need to delete the staticmenu.html file. The following code is added in the background to clear the cache:

(! CacheManager = (System. IO. File. Exists (Server. MapPath (RedirectToAction (,

 

The code is simple and will be slow during the first access.

Close.

Welcome to join the NopCommerce group.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.