I am revising for exam 70-562 on ASP.NET application development and the last chapter on caching has brought up a few questions:
- What is the difference between Response.AddCacheDependency(...) and Response.AddCacheItemDependency(...)? The former uses a CacheDependency object and the latter is an item in the cache, but a CacheDependency object itself references an item in the cache.
In page output caching, the following properties can be set:
-NoStore for secondary storage -Location for caching localtion (what is downstream - I know this is from server to client - but what this setting mean for this property?) -Shared - this means user control output can be sha开发者_JAVA百科red between pages. Any example of how this works?
Thanks
AddCacheDependency: When overridden in a derived class, associates cache dependencies with the response that enable the response to be invalidated if it is cached and if the specified dependencies change. (Overrides HttpResponseBase..::.AddCacheDependency(array[]).) AddCacheItemDependency: Makes the validity of a cached response dependent on the specified item in the cache. (Overrides HttpResponseBase..::.AddCacheItemDependency(String).)
Downstream - The output cache can be stored in any HTTP 1.1 cache-capable devices other than the origin server.This includes proxy servers and the client that made the request.
See following:
http://msdn.microsoft.com/en-us/kb/kb00323290.aspx
http://blogs.msdn.com/codefx/archive/2009/09/07/asp-net-output-cache.aspx
Update sample code with different properties and enjoy it.
精彩评论