Explore the ~~~5 of the ASP. Cache (page cache + Level two cache) for the MVC5 series

Source: Internet
Author: User

In fact, any information inside any knowledge point is irrelevant, is not important, the important thing is to learn the method, the process of self-exploration (wrong place welcome correct)

Summary:HTTP://WWW.CNBLOGS.COM/DUNITIAN/P/4822808.HTML#MVC

This chapter demo: HTTPS://GITHUB.COM/DUNITIAN/LOTCODEBASE/BLOB/MASTER/NETCODE/6. Web Base/bmvc5/mvc5base/controllers/ CacheController.cs

This time to relax, let's not always say safety-related things. Cache this thing is not unique to MVC, n years ago, a brief introduction of the usual project inside the use of (Redis,memcache, etc. next time to say)

1. Page cache:

First say the most common one:[OutputCache (Duration =)] , Duration unit is seconds

The first time to return to the point of the breakpoint, in 100 seconds any refresh will no longer execute the controller inside a ()

With parameter caching

[OutputCache (Duration = +, VaryByParam = "id")] [OutputCache (Duration = +, VaryByParam = "Id;name")]

The breakpoint stops at the first visit to the cache/b?id=1 and does not enter a breakpoint in 100s. Re-enter the breakpoint when id=2. Similar to multiple parameters, note that the parameter segmentation is ;

---------------------------------------------------------------------------------------------------

2. Level Two cache:(system.web; System.Web.Caching;)

2.1 Absolute Expiration Cache

HttpRuntime.Cache.Add (key, list, NULL, DateTime.Now.AddSeconds), Cache.noslidingexpiration, Cacheitempriority.default, null);  

2.2 Relative Expiration cache (a bit of a session feeling)

HTTPRUNTIME.CACHE.ADD (key, list, NULL, cache.noabsoluteexpiration, new TimeSpan (0, 0, ten), Cacheitempriority.default, NULL);

2.3 Database Dependent Cache

Detailed parameters: https://msdn.microsoft.com/zh-cn/library/ms229862

Other: file-dependent cache , rarely used, usually based on the last modification time of the file to determine the timing difference

Other content can refer to Bo Friends of this article: http://www.cnblogs.com/knowledgesea/p/3904929.html

Cond......

Explore the ~~~5 of the ASP. Cache (page cache + Level two cache) for the MVC5 series

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.