ASP programming into the first step (19): ASP skills are accumulated (2)

xiaoxiao2021-03-06  39

Strict Control Session can move content that does not require session (such as Help Screen, Accessor Area, etc.) to close the SESSION's standalone ASP application. On the foundation page, you can give an indication to the ASP, so it doesn't need to use session. Add the following code directly to the header of the ASP page: <% @ enablessionsState = false%> The data typically used in the web server is typically used: the ASP page retrieves the data from the background storage, then use hypertext tags Language (HTML) formation results. Regardless of the speed of the database, retrieving data from memory is much faster than from the background storage device. Reading data from a local hard drive is usually very fast. Therefore, improve performance can be implemented by data on the cache server, whether it is cacked in memory, or in the local hard disk. The cache is a classic "spatial change time". If the cache is appropriate, you can see a significant performance improvement. In order to make the cache valid, it is necessary to ensure that cache data is often reused, and it is also cumbersome. The cache filled with old data is a waste of memory. The data that does not change often is a better object of the cache because it is not necessary to consider the synchronization operation after this data update. Combination box, reference table, DHTML code, extended tag language string, menu, and site configuration variables (including data source name, Internet protocol address IP, and web paths) are well cache objects. Note: To cache data expressions instead of the data itself. If an ASP page changes frequently and firms (such as the entire product catalog), you should consider pre-generating HTML instead of each time a request is taken. The Application and Session objects in the APPLICATION or SESSION objects are used in the data ASP in the APPLICASP are a convenient container that caches data in memory. You can assign data to Application and Session objects, which will remain in memory during HTTP calls. The data in the session is for each user, and the data in Application is shared by all users. When will I need to load data in Application and Session? Typically, the data is loaded when the application starts or when the session begins. In order to load data at this time, add the appropriate code to Application OnStart () or Session OnStart (). These functions are located in the file global.asa, and if it does not exist, add it. You can also transfer it when the data is first required, add code to the ASP page, check if the data exists, if you don't find it, you will be transferred. Here is an example that represents a classic performance processing technology called "lazy evalution": until it is needed, then calculate. When copying frequently used data to the script variable, when you use a COM object in the ASP, you should copy the frequently used object data to the script variable, which reduces the method call to the COM object. These calls are relatively expensive than access script variables. Use this technique when you access the Collection and Dictionary objects, also reduces expensive lookup operations. Typically, if you need to access object data over one time, data should be placed in a script variable, and the object data is mainly the request variable (form and query string variable).

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

New Post(0)