The Cache-Control header can be used to expire content immediately or disable caching altogether. The value of this header determines whether cached portlet content can be shared among different users.
public | Allows any cached content to be shared across users with identical sets of preferences using the same Portal Server. This value should be used whenever possible. |
private | Tells the Portal Server not to share cached content. The User ID is added to the cache key so that a separate copy is retained in the cache for each individual user. This value should only be used to protect sensitive information, for example, an e-mail inbox portlet. (User settings can also make public content effectively private.) |
max-age=[seconds] | Specifies the maximum amount of time that an object is considered fresh. Similar to the Expires header, this directive allows more flexibility. [seconds] is the number of seconds from the time of the request that the object should remain fresh. |
must-revalidate | Tells the cache that it must obey any freshness information it receives about an object. HTTP allows caches to take liberties with the freshness of objects; specifying this header tells the cache to strictly follow your rules. |
no-cache | Disables caching completely and overrides Web Service editor settings. Neither the client nor the Portal Server responds to subsequent requests with a cached version. |
<% response.setHeader("Cache-Control","public"); %>
<% response.setHeader("Cache-Control","max-age=0"); %>
Response.Cache.SetCacheability(HttpCacheability.Public);
TimeSpan ts = new TimeSpan(0,0,0); Response.Cache.SetMaxAge(ts);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);