软件专业 毕业论文 外文翻译.doc_第1页
软件专业 毕业论文 外文翻译.doc_第2页
软件专业 毕业论文 外文翻译.doc_第3页
软件专业 毕业论文 外文翻译.doc_第4页
软件专业 毕业论文 外文翻译.doc_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

大连交通大学2011届本科生毕业设计(论文)外文翻译外文原文ASP.NET Caching Function with the Creation ofHigh Performance WebJonothon Ortiz, ASP.NET Web Developers Guide (VBL)i. IntroductionSince the birth of the Internet, IT and development staff has been facing such problems, that is, how to create rapid response to user requests for Web applications, especially if the server is processing a large number of requests can respond quickly to user requests for Web applications. ASP.NET model provides many buiblt-in functions to enhance performance, caching is one of the important functions. ii. BriefIn practice, the generation of high performance, Scalable Web applications most important factor is one of the first to request these items will be stored in the Web services Treasury or request for a stream of other software, such as proxy servers or browsers, to avoid re-establish previous request to meet the information, particularly those requiring a large number of processor time or resources. This is commonly referred to the cache, It allows the use of a variety of technologies across HTTP request page output or storage application data and its reuse, Servers do not need to re-create information, thereby saving time and resources. ASP.NET provides two can be used to build high-performance Web caching application types. The first one is called the output cache, It allows dynamic page or user control response stored in the output stream (launched from the server to request the browser) with any H TTP1.1 cache function of equipment. When behind at the time of the request,the non-implementation of a page or user control code for the output buffer to meet the request. The output buffer cache may be targeted at the entire page, and can also be part of page. The second type of cache is a traditional application data cache, It can be used to programmatically arbitrary object (eg, data sets) storage memory to the server, so that Application procedures can save these objects re-establish the necessary time and resources. iii. Cache whole pageASP.NET permitting the browser function of the mechanism for dynamic caching the entire page response, These mechanisms refers browsers, proxy servers and application procedures for the presence of the Web server. It provides a powerful means to improve Web application performance. This technique is called the output cache, which allows the cache to meet behind specific page on the request, so that When behind the request at the time of the initial operation will be no need to create code pages. Use of the technology to cache site most frequently visited pages can be fully enhance the throughput of the Web server (usually per second Number of requests). In a busy site, if Cache been frequently visited pages, and even if only a minute, can greatly improve performance. When pages in the output cache, on the pages of the additional request is treated Cache, it is not enforced and recompile the code to create pages. When the operation page output cache, they can choose a high-level declarative API or low-level programming API. You can OutputCache directive will be included in the page. Aspx use of the former documents. OutputCache Order to meet page output cache when almost all the normal demand. Output Cache complete syntax is as follows : The parameters are as follows :l DurationPage or user control caching for time (in seconds). In a page or user control on the setting up of the attributes of the object from the HTTP response to the establishment of an outdated strategy Cache will automatically page or user control output. l LocationLocation OutputCache one of the enumeration values. designated location in which cache pages, default values for Any. l SharedA Boolean value to determine whether user control output can be shared by a number of pages. The default value to false.l VaryByControlA semicolon-separated list of strings used to change the user controls the output buffer. These strings on behalf of the user controls the stated ASP.NET server controls the ID attribute values.l VaryByCustomSaid that since the output buffer requirements definition arbitrary text. If given the attribute value is browser, the cache will be with the browser name and major version information are different. l VaryByHeaderSemicolon-separated list of HTTP headers, the output cache for change. When this attribute is set to more headers, for each designated headers, the output cache contains a request for documentation of the different versions. l VaryByParamSemicolon-separated list of strings, the output buffer for a change. By default, these strings using the GET method attributes Send inquiries string value counterparts, or with the use of this method POST parameters counterparts. When this attribute is set to more parameters, for each designated parameters, output buffer includes a request for documentation of the different versions. Possible values include none, * and any effective inquiry string or POST parameter name. The following commands (as in. Aspx document pm) for the dynamically generated page set the output buffer of 60 seconds when due time : When using the OutputCache directive. Duration and VaryByParam attribute is essential. If they are not included, the first page request analyzers errors will occur. If you do not want to use the VaryByParam attribute function, its value must be set to None. ASP.NET also includes a set of APIs. By HttpCachePolicy class programming to control the output cache pages due time and strategy slightly. HttpResponse.Cache through the use of such attributes. Page.Response can attribute Page Object Access from the property.For example, The following code (when including the code page statement or block its code hidden category pm) HttpCachePo licy.SetExpires method for dynamically generated page set up 60 seconds due time :Response. Cache.SetExpiresDateTime.Now.AddSeconds(60);Once the opening of the output buffer, This page is the first one in HTTPGET request within the specified time of its dynamic content placed in the output buffer. Output caching meet face after page of GET, HEAD, or POST request until more than a specified amount of time. Programmers can also use statement or programming in the manner, at the request flow to enable or disable the cache support equipment for the page output cache. In the OutputCache page directive, Location attribute can be used to designate whether the page output caching proxy server, browser client, the original Web server or all of these equipment, or the equipment in the cache of any one. Programming can be implemented in the same operation, HttpCachePolicy.SetCacheability use methods appropriate for the specified page When the HttpCacheAbility enumeration value.Also with inquiries from the string parameters GET request with parameters or Form POST request generated in response to Jin OK Cache, However, we must use the OutputCache directive VaryByParam attribute to the opening of transmission parameters Cache. We need to be aware : Programming approach to the output buffer for any operation to be. aspx document code block statement, or with the. aspx files associated with the code for hidden category. iv. Resolution CacheSometimes, no caching the entire page, but may need to create dynamic each request certain parts of the page. Resolution Cache Cache including allowing users control any response to the request for production of the parts. In these circumstances, need to spend time marking require substantial resources to construct server with page requests linked to the object or data. Once the identification of these projects, on the Web through user controls Form Creating these items to them from other parts of the page separated, Then in a prescribed period of time on these items cache to save server resources. This is commonly referred to fragment cache. This technology allows certain parts of the page (such as database queries) and other parts of the page separation. Programmers can choose to allow for dynamically generated for each request requires less server resources of the page.Once the logo to the page cache, and create a right for each part of the Packaging user controls, These users must determine the Cache Control Strategy. When hidden code to create user category Controls, use OutputCache directive to the installation of these statements strategy PartialCachingAttribute or use similar methods to install such programming strategy. If, for example, the following command will include the user controls (ASCX) to the top The controls were a version of the output buffer storage of 120 seconds : Likewise, the use of hidden code development method development of the user controls, the following attributes will be included in the category statement yuan data, Control version of the output buffer storage of 120 seconds. PartialCaching(120)If the use of these technologies in any one, when the requesting user controls include the page, users will only cache control. If the page statement and the use of the output buffer for the specified user controls, ASP.NET pages will be based on the analyzer controls the creation, Object of two types of a type of example. If built in a statement users Controls will add StaticPartialCachingControl object; If the use of LoadControl ways to programmatically create user controls. Partial-CachingControl object is added. Thus, when the request for the page, if the page is not cached. Add analyzer will target users control the pages of control hierarchy structure as a logical location. Because the user controls can be nested in the other page server controls, So also can be nested Add output has been cached user controls. This means that the output cache can be included in the instructions on page output caching user controls, or included in the output buffer as another part of the user controls which users control. v. Caching data applicationsASP.NET provides a powerful, easy-to-use caching mechanisms, Allow will need a lot of server resources to create the object stored in the memory. It is achieved by the Cache class, and examples of each application-specific, its survival depends on the application of survival. Re-start the application process, will be re-created Cache object. Cache design category is intended to facilitate use. Through the use of market value and the key pairs can be placed in the cache items and retrieve them at a later date. Cache class provides a simple interface definition from the cache. It also provides a powerful feature allows custom items and Cache Cache time. For example, when the lack of system memory, Cache automatically remove rarely used or unimportant items to allow the use of memory to handle the large number of requests. This technique is called liquidation. This is to ensure that non-cached data is not current use of valuable server resources in a different form. When liquidation, the program can give instructions Cache certain items than other items higher priority. To instructions specific items other than having a higher or lower importance need to use Cache.Add Cache.Insert method or methods to add an item designated C acheItemPriority enumeration value. When using the Add method or methods to Insert items added to the cache, but also due to the establishment of strategic items. Programming can absolutionExpiration parameters through the use of the definitions of survival, The parameters DataTime type, it designated for the exact expiration of the time. SlidingExpiration can use parameters, the parameters of TimeSpan types. It allows programmers visit items under the designation of the time before the expiration of the running time. Once it expired, and put it removed from the cache. Attempting to retrieve its value will return null, unless it was re-added to the Cache. Were Cache for storage in the easy to miss (for example, those who frequently updated data or only those within a certain period of time effective), the setting up of a mature strategy, as long as these items remain at the latest data. They will be retained in the cache were. For example, suppose the preparation of an application, The application procedure from a frequently updated Web site access to data to track sports score, So long as the source of a Web site contest Scores not change, we can match these cache. In this case, according to the Web site to update the score to set the frequency due strategies. Code can be prepared to determine whether Cache is the latest score, if the score is not the latest, then the source code from the Web site updated score. Also under ASP.NET also allows external files, directories or another definition Cache Cache items arrival. These documents called dependence on key items and items. If the change in dependency, failure cache item was removed from the cache. Were Able to use the technology in the above changes to the source data from the Cache Remove these items. If, for example, the preparation of an XML document handling financial data applications, and presents it in graphic, was able to pass the document to insert data in the cache and XML documents on a reservation items. When the updated document, removed from the cache, application procedures, re-read the document, then insert it in a new version. vi. Enhance the performance of other methodsIn addition to high-speed caching, ASP.NET also built a number of other functions can be optimized Web applications, Performance enhancing procedures, which are listed below for reference part. n When not using conversational state banned it.n Conversational carefully selected to provide state procedures.n Avoid unnecessary server and from the process. n Use Page.IsPostBack to avoid unnecessary and from the process of implementation of the treatment. n the use and possible at the appropriate time to use ASP.NET server controls. n Avoid excessive use of server controls View state. Livanos methods used System.Text.StringBuilder strings. n Do not rely on the code anomalies.n Data Access using SQL stored procedures. n the appropriate use of the Common Language Runtime garbage recycling and automatic memory management. n If a large-scale Web applications, may consider implementing pre-approved translation. necessary adjustment assistance application process each thread of a few. vii. Conclding remarksThis paper mainly describes the ASP.NET Cache technology, respectively for the three types of cache of detailed, Finally, it provides some optimization ASP.NET Web application performance methods. 中文翻译用ASP.NET缓存功能创建高性能WEB一、引言自从Internet诞生以来,开发人员和IT人员就一直面临着这样的难题,即如何创建快速响应用户请求的Web应用程序,尤其是即使服务器正在处理大量请求时也能快速响应用户请求的Web应用程序。ASP.NET模型提供了许多内置的性能增强功能,缓存是其中一项重要功能。二、简介在实践中,生成高性能、可缩放的Web应用程序最重要的因素之一是都能够在首次请求时将这些项存储在Web服务器上或请求流中的其他软件上,例如代理服务器或浏览器,以避免重新创建满足先前请求的信息,尤其是那些需要大量处理器时间或资源的信息。这就是通常所说的缓存,它允许使用多种技术跨HTTP请求存储页输出或应用程序数据并对其进行重复使用,服务器不需要重新创建信息,从而节省了时间和资源。ASP.NET提供了两种可以用来创建高性能Web应用程序的缓存类型。第一种叫做输出缓存,它允许将动态页或用户控件响应存储在输出流(从发起服务器到请求浏览器)中任何具备HTTP1.1缓存功能的设备上。当后面的请求发生时,不执行页或用户控件代码,缓存的输出用于满足该请求。在输出缓存中缓存的对象可以是整个页面,也可以是部分页。第二种类型的缓存是传统的应用程序数据缓存,可以使用它以编程方式将任意对象(例如数据集)存储到服务器内存,这样,应用程序可以节省重新创建这些对象所需的时间和资源。三、缓存整页ASP.NET允许在具有HTTP1.1功能的机制上缓存动态页的整个响应内容,这些机制指浏览器、代理服务器和应用程序所驻留的Web服务器等。它提供了一个强有力的方式来提高Web应用程序的性能。此技术叫做输出缓存,它允许从缓存满足后面的对特定页的请求,这样,当后面的请求发生时就不需要运行最初创建页的代码。使用该技术来缓存站点中最经常访问的页可以充分提高Web服务器的吞吐量(通常以每秒的请求数计算)。在一个繁忙的网站上,如果高速缓存被经常访问的页面,即使只是1分钟,也能大大提高性能。当页面处于输出高速缓存时,对该页面的额外请求是以高速缓存对待的,它不会执行并重新编译创建页面的代码。当操作页的输出缓存时,可以选择高级别的声明性API或低级别的编程API。您可以通过将OutputCache指令包括在该页的.aspx文件中使用前者。OutputCache指令可以满足缓存页输出时几乎所有的一般需求。输出高速缓存的完整语法如下:参数的说明如下:l Duration页或用户控件进行缓存的时间(以秒计)。在页或用户控件上设置该属性为来自对象的HTTP响应建立了一个过期策略,并将自动缓存页或用户控件输出。l LocationOutputCacheLocation的枚举值之一,指定在哪个位置高速缓存页面,默认值为Any。l Shared一个布尔值,确定用户控件输出是否可以由多个页共享。默认值为false。l VaryByControl一个分号分隔的字符串列表,用于更改用户控件的输出缓存。这些字符串代表在用户控件中声明的ASP.NET服务器控件的ID属性值。l VaryByCustom表示自定义输出缓存要求的任意文本。如果赋予该属性的值是browser,缓存将随浏览器名称和主要版本信息的不同而不同。l VaryByHeader分号分隔的HTTP标头列表,用于使输出缓存发生变化。当将该属性设为多标头时,对于每个指定的标头,输出缓存都包含一个请求文档的不同版本。l VaryByParam分号分隔的字符串列表,用于使输出缓存发生变化。默认情况下,这些字符串与用GET方法属性发送的查询字符串值对应,或与用POST方法发送的参数对应。当将该属性设置为多参数时,对于每个指定的参数,输出缓存都包含一个请求文档的不同版本。可能的值包括none、*和任何有效的查询字符串或POST参数名称。下面的指令(当包括在.aspx文件中时)为动态生成页的缓存输出设置60秒的到期时间:当使用OutputCache指令时,Duration和VaryByParam属性是必需的。如果不将它们包括在内,则首次请求页时将出现分析器错误。如果不想使用VaryByParam属性提供的功能,则必须将其值设置为None。ASP.NET还包括一组API,它们通过HttpCachePolicy类以编程方式控制页的输出缓存的到期时间和策略。通过HttpResponse.Cache属性可以使用该类,可以通过Page.Response属性从Page对象访问该属性。例如,下面的代码(当包括在页的代码声明块或其代码隐藏类中时)使用HttpCachePolicy.SetExpires方法为动态生成的页设置60秒的到期时间:Response.Cache.SetExpiresDateTime.Now.AddSeconds(60);一旦启用了输出缓存,该页的第一个HTTPGET请求会在指定的时间内将其动态内容放置在输出缓存中。输出缓存满足后面对该页的GET、HEAD或POST请求,直到超过指定的时间量。程序员还可以用声明或编程的方式,在请求流中启用或禁用支持缓存的设备的页输出缓存。在页的OutputCache指令中,可以使用Location属性指定是否将页输出缓存在代理服务器、浏览器客户端、原Web服务器或所有这些设备中,或者不缓存在这些设备中的任何一个。可以以编程方式执行同样的操作,使用HttpCachePolicy.SetCacheability方法为页指定适当的HttpCacheAbility枚举值。还可以对由带有查询字符串参数的GET请求或带有参数的窗体POST请求生成的响应进行缓存,但必须使用OutputCache指令的VaryByParam属性启用对传递参数的缓存。需要注意的是:要以编程方式对输出缓存进行的任何操作必须在.aspx文件的代码声明块中进行,或在与该.aspx文件关联的代码隐藏类中进行。四、分段的高速缓存有时候,不需要缓存整个页,而可能需要为每个请求动态创建页的某些部分。分段的高速缓存允许高速缓存包括用户控件的任何请求生成的响应的各部分。在这些情况下,需要花时间来标识需要大量的服务器资源来构造与页请求相关联的对象或数据。一旦标识了这些项,就可以通过在WEB窗体用户控件中创建

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论