EPiWiki.se  - EPiServer notes shared with others
 

EPiServer extensions for the output cache

[Edit]

Technical description of EPiServer extensions for the output cache


Configuration


EPiServer.config
httpCacheExpiration - Change this value to set the number of seconds a page should be cached, this value will be set in the http request policy. It will activate both client side caching and server caching (outputcache). Policy will only apply to anonymous users and when http request method is GET. The cache will automatically be updated when changes are made to a page in EPiServer. Recommended setting is 1 hour.

httpCacheability - Change this value to modify the cacheability of pages when using output caching. I e only used when httpCacheExpiration is set to a non-zero value. Use values from the System.Web.HttpCacheability enumeration.

httpCacheVaryByCustom - The custom values the browser should vary by

httpCacheVaryByParams - The parameters to the page(ie querystring) that the cache should vary by

<configuration>
  <episerver>
    <sites>
      <site>
        <siteSettings ...
           httpCacheExpiration="0:20:0"
           httpCacheability="Public"
           httpCacheVaryByCustom="path"
           httpCacheVaryByParams="id,epslanguage"

Cache implementation


EPiServer has one cache item DataFactoryCache.Version (Int64).
On PageInit in EPiServer.PageBase the following output cache values are added
Expires = Now + Config settings httpCacheExpiration
Cacheability = Config setting httpCacheability
VaryByParams = Config setting httpCacheVaryByParams
VaryByCustom = Config setting httpCacheVaryByCustom
ValidUntilExpired = true
Adding dependency to DataFactoryCache.Version cache entry

Cleaning the cache


The cached item DataFactoryCache.Version is updated and all dependent output cache pages are removed from the cache.
Version author:
Mattias Lövström

EPiServer version

All