最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ASP.NET的缓冲处理
时间:2022-07-02 12:07:35 编辑:袖梨 来源:一聚教程网
Caching OverviewCaching is a technique that is widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In the context of a Web application, caching is used to hold onto pages or data across HTTP requests and reuse them without the expense of recreating them.
ASP.NET has two kinds of caching that can be utilized by Web applications.
Caching the dynamic response generated by a request is known as Output Caching.
The caching of arbitrary objects programmatically is known as Data Caching. To support this, ASP.NET provides a full featured Cache engine that allows programmers to easily hold onto data across requests.
Output caching is useful when the contents of an entire page can be cached. On a heavily accessed site, caching frequently accessed pages for even a minute at a time can result in substantial throughput gains. While a page is cached by the output cache, subsequent requests for that page are served from the output page without executing the code that created it.
Sometimes it's not practical to cache an entire page--perhaps portions of the page must be created or customized for each request. In this case, it's oftentimes worthwhile to identify objects or data that are expensive to construct that are eligible for caching. Once these items are identified, they can be created once and then cached for some period of time.
Choosing the time to cache an item can make for an interesting decision. For some items, the data might be refreshed at regular intervals or the data is valid for a certain amount of time. In that case, the cache item can be given an expiration policy that will cause them to be removed from the cache when they're expired. Code that accesses the cache item simply checks for the absence of the item, and recreates it if necessary.
The ASP.NET cache supports file and cache key dependencies, allowing developers to make a cache item dependent on an external file or another cache item. This technique can be used to invalidate items when their underlying data source changes.
相关文章
- 致命公司传送器有什么用 传送器作用介绍 12-06
- dota2骑士之倚有什么用 骑士之倚效果介绍 12-06
- 致命公司雷达增强器怎么用 雷达发射器使用教学 12-06
- 恋爱吗我家的猫会后空翻第一章全流程攻略 12-06
- 星球重启球球宠物心愿解锁条件一览 12-06
- 星球重启冰霜琥珀在哪 冰霜琥珀位置一览 12-06