This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21359|Reply: 1

[ASP.NET] HttpRuntime Cache reads set cache information encapsulation

[Copy link]
Posted on 4/20/2018 3:23:55 PM | | |
 Landlord| Posted on 4/20/2018 3:31:38 PM |

We are in . Cache objects are often used in .NET applications.
In addition to the Cache under System.Web.Caching, we can also use HttpContext.Current.Cache and HttpRuntime.Cache
So, what is the difference between HttpContext.Current.Cache and HttpRuntime.Cache?
As can be seen from the explanation on MSDN,HttpRuntime.Cache is at the application levelHttpContext.Current.Cache is defined for the current WEB context
However, in fact, both of them are called to the same object, the difference is that in addition to being available in WEB, non-WEB programs can also use HttpRuntime.
HttpContext, on the other hand, can only be used on the web.
So we use HttpRuntime whenever possible (however, how to call between different applications is also a problem).
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com