It's awkward

xiaoxiao2021-03-06  53

The first is that it is the recent project development, which is the recent project development. When the trial operation, several problems due to improper cache settings, discussed, and in any case, hope to point one or one, Page Output Cache Problem Problem Description: On a website home page, there are several users logged in box box, after logging in to hide, and displays the information about the user, because this is the first page, considering the amount of access, and the page The update is also relatively small, so use <% @ outputcache duration = "60" VaryByParam = "None"%> to enable page output cache, but find a problem: After the second user is logged in, it is true that it is the first user. Login Information Problem Analysis: The page output cache is after the first user issued a request, and the static content generated from the dynamic page in the high-speed buffer generated in the dynamic page, in the set time, the subsequent requests are from the cache. Response, so there is a problem that the above description is

Problem Solution: Do not use the page output cache, this is a personalized sacrifice performance, but in order to minimize performance loss, in addition to the data cache in the middle, you must split the page via the user control, and perform the page closing cache.

Summary: Through this problem, I found that anywhere you need to display personalized information, usually do not properly do page output cache, for this problem, in order to improve performance, I have a few ideas: 1. Try to consider the other as much as possible in the login area The page is logged in; 2. Personalized information is required to put on another page, then IFrame comes in, so that the page can take care of the personality and performance, suitable for personalized information; 3, if the page does not do page output Cache, then consider whether you can do a page sluggish cache, always consider whether you should perform data cache

Second, the problem problem problem caused by the data cache: We cache the age information obtained from the database, the code is as follows: public static gradecollection getgrades () {string cachekey = "gradecollection"; if (httpruntime.cache [cachekey] == null) HttpRuntime.Cache [cacheKey] = DataProvider.GetGrades (); return (GradeCollection) HttpRuntime.Cache [cacheKey];} and the data processing and then to a bonding dropdownlist in: GradeCollection gc = GetGrades (); Grade g = New grade (); g.gradeName = "all grades"; gc.insert (0, g); the problem is coming out, running this code, other places again getgrade () get data will be changed data , This is not what we expect.

转载请注明原文地址:https://www.9cbs.com/read-88226.html

New Post(0)