They are caught in trouble (go to http:blog.9cbs.netkwklover)

xiaoxiao2021-03-06  76

Entry:

It's awkward

Recent project development has been completed, when trial run, find a few problems caused by cache settings, write down, discussions, unprical, hope to give pointers issues, page output caches, problem description: On a website home page, there are several users logged in, and they are hidden after logging in and displays the information about the user, because this is the first page, considering that the number of accesses is large, and the page updates are relatively small, so <% @ OutputCache Duration = "60" VarybyParam = "None" to enable page output cache, but find a problem: After the second user user is logged in, it is indeed the first user's login information problem analysis: page output cache is After the first user issues a request, the static content generated from the dynamic page is cached in the servers in the cache, and the subsequent requests are in response from the cache, so it may appear above. The problem

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-87787.html

New Post(0)