简体   繁体   中英

What's the best caching mechanism to use for .Net web applications?

What caching mechanism should I use for a .Net web application? Memcached seems to be the best for the LAMP stack and Linux in general, but I'm not so sure that it's the answer for a .Net web application running on Windows. My requirements are that it be distributed and that it run on Windows.

There isn't a distributed caching system as mature as memcached for Windows, but Velocity is the distributed caching system being built by Microsoft and has a beta version available for download.

Though what I've seen a lot of people do is run memcached on Linux, and use one of the .NET clients for memcached in their ASP.net code.

Check out ScaleOut StateServer - it was primarily developed to provide high performance, out-of-process, distributed session management in a web farm scenario, but it is for general-purpose caching as well.

It is a mature product too - but it ain't free. The main benefit is it was designed specifically to work with the ASP.NET / Windows stack.

ASP.NET offers two caching strategies out of the box, application caching and page output caching. For more information please see ASP.NET Caching Overview :

Often an application can increase performance by storing in memory data that is accessed frequently and that requires significant processing time to create. For example, if your application processes large amounts of data using complex logic and then returns the data as a report accessed frequently by users, it is efficient to avoid recreating the report every time a user requests it. Similarly, if your application includes a page that processes complex data but that is updated only infrequently, it is inefficient for the server to recreate that page on every request.

To help you increase application performance in these situations, ASP.NET provides caching using two basic caching mechanisms. The first is application caching , which allows you to cache data you generate, such as a DataSet or a custom report business object. The second is page output caching , which saves the output of page processing and reuses the output instead of re-processing the page when a user requests the page again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM