The cache can be conveniently used in ASP. NET. For cache, there are generally two methods to call: httpcontext. cache and httpruntime. cache. So what are the differences between the two types of cache?
Let's take a look at the notes on
I have read this article HttpContext. Cache and HttpRuntime. Cache
Then, use. NET Reflector to view the source code: HttpRuntime. Cache is returned in the HttpContext class.
public Cache Cache{ get { return HttpRuntime.Cache;
System. Web. HttpContext. Current. Cache attribute -----> is a "property value"
System. Web. httpruntime. cache attribute --------------->Is a "property value"
System. Web. caching. CacheWebCache = ***--------> Is a "class"
For example,
In. net, cache has two calling methods: httpcontext. Current. cache and httpruntime. cache. What are the differences between the two methods? Let's take a look at the explanations on msdn:
Httpcontext. Current. cache: gets the cache object for the
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/avon520/archive/2009/11/25/4872704.aspx
In. net, cache has two calling methods: httpcontext. Current. cache and httpruntime. cache. What are the
Developers familiar with ASP. NET know that ASP. NET has a very powerful object HttpContext. For convenience, ASP. NET also provides it with a static attribute HttpContext. Current to access it,Today's blog is going to start with HttpContext.
Reposted from Jun. net
Someone has already said this topic. Related links:
Httpruntime. cache vs. httpcontext. Current. CacheHttp://weblogs.asp.net/pjohnson/archive/2006/02/06/437559.aspx
Httpcontext. cache and httpruntime. CacheHttp://blog.
Suppose we are as follows:CodeHttpcontext. Current. cache is called.
Public class cachemanager {public static httpcontext mhttpcontext = httpcontext. Current; Public void setcache
(String key, T value) {mhttpcontext. cache. insert (Key,
I. Overview of HttpContextHttpContext the HttpApplication-based processing pipeline, because the HttpContext object runs through the entire process , the state data can be passed from the front end of the HttpApplication processing pipeline to the
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.