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.