【正文】
七、結(jié)束語 本文主要闡述了 中的高速緩存技術(shù),分別對三種類型的緩存進(jìn)行了詳細(xì)的闡述,最后還提供了一些可以優(yōu)化 應(yīng)用程序性能的方法。 可以使用該技術(shù)在項的數(shù)據(jù)源更改時從 Cache 中移除這些項。可以編寫代碼來確定 Cache 中是否是最新的比分,如果該比分不是最新的, 則該代碼可以從源 Web 站點(diǎn)更新比分。試圖檢索其 值將返回 null,除非該項被重新添加到 Cache 中。編程者可以通過使用 absolutionExpiration 參數(shù)定義項的生存期,該參數(shù)為 DataTime 類型,它用于指定該項的確切到期時間。這是緩存確保非當(dāng)前數(shù)據(jù)不使用寶貴的服務(wù)器資源的一種方式。 設(shè)計 Cache 類是為了便于使用。這意味著可以將輸出緩存指令包括在輸出緩存頁內(nèi)的用戶控件中,或包括在作為另一個輸出緩存用戶控件一部分的用戶控件中。 如果在頁中聲明并使用了為輸出緩存指定的用戶控件,則 頁分析器將根據(jù)用戶控件的創(chuàng)建方式,對兩個對象類型中的一個類型進(jìn)行實例化。 一旦標(biāo)識了要緩存的頁的部分,并且創(chuàng)建了對每個部分進(jìn)行封裝的用戶控件后,必須確定這些 用戶控件的緩存策略。一旦標(biāo)識了這些項,就可以通過在 WEB 窗體用戶控件中創(chuàng)建這些項將它們從頁的其它部分分離出來,然后在一段指定的時間中對這些項進(jìn)行緩存,以節(jié)省服務(wù)器資源。 需要注意的是:要以編程方式對輸出緩存進(jìn)行的任何操作必須在 .aspx 文件的代碼聲明塊中進(jìn)行,或在與該 .aspx文件關(guān)聯(lián)的代碼隱藏類中進(jìn)行。 程序員還可以用聲明或編程的方式,在請求流中啟用或禁用支持緩存的設(shè)備的頁輸出緩存。通過 屬性可以使用該類 , 可以通過 屬性從 Page 對象訪問該屬性。 下面的指令(當(dāng)包括在 .aspx文件中時)為動態(tài)生成頁的緩存輸出設(shè)置 60 秒的到期時間 : % OutputCache Duration=”60” VaryByParam=”None”% 當(dāng)使用 OutputCache 指令時, Duration 和 VaryByParam 屬性是必需的。 ? VaryByParam 分號分隔的字符串列表,用于使輸出緩存發(fā)生變化。 ? VaryByCustom 表示自定義輸出緩存要求的 任意文本。 ? Shared 一個布爾值,確定用戶控件輸出是否可以由多個頁共享。 OutputCache 指令可以滿足緩存頁輸出時幾乎所有的一般需求。在一個繁忙的網(wǎng)站上,如果高速緩存被經(jīng)常訪問的頁面,即使只是 1 分鐘,也能大大提高性能。 三、緩存整頁 允許在具有 功能的機(jī)制上緩存動態(tài)頁的整個響應(yīng)內(nèi)容,這些機(jī)制指瀏覽器、代理服務(wù)器和應(yīng)用程序所駐留的 Web 服務(wù)器等。第一種叫做輸出緩存, 它允許將動態(tài)頁或用戶控件響應(yīng)存儲在輸出流(從發(fā)起服務(wù)器到請求瀏覽器)中任何具備 緩存功能的設(shè)備上。 模型提供了許多內(nèi)置的性能增強(qiáng)功能,緩存是其中一項重要功能。 外文原文 Caching Function with the Creation of High Performance Web Jonothon Ortiz, 《 Web Developers Guide (VBL)》 i. Introduction Since the birth of the Inter, 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. model provides many buibltin functions to enhance performance, caching is one of the important functions. ii. Brief In 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 reestablish previous request to meet the information, particularly those requiring a large number of processor time or resources. This is monly 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 recreate information, thereby saving time and resources. provides two can be used to build highperformance 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 cache function of equipment. When behind at the time of the request,the nonimplementation 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 reestablish the necessary time and resources. iii. Cache whole page 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 大連交通大學(xué) 2021 屆本科生畢業(yè)設(shè)計(論文)外文翻譯 1 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 pa