Hide menu Last updated: Mar 21 2013

Introduction

This section provides an overview of caching in the EPiServer platform.There are many different possibilities to control and configure caching. The EPiServer CMS SDK provides more information on caching for areas such as page data, output, VPP and Dynamic Data Store (DDS).

For the EPiServer platform, it is possible to configure which cache information is added to the response headers at request of static files. This can be used so files can be cached by the client and not served by the web server at each request meaning the total request time for a client can be reduced significantly.

Configuring Static Files Caching

The setting in web.config that controls the cache header directives “Expires” and “Cache-Control” is the configuration section staticFile that is allowed to be set on location level. This means it is possible to set different expiration times depending on the path to the static file.

Sample where an Expires time is set globally for the site and where that expiration time is overridden in a sub path.

CopyXML
 <configuration>
    ...
     <staticFile expirationTime="12:0:0" />
    ...
    <location path="Documents">
        <system.webServer>
            <handlers>
                <add name="wildcard" path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer.Framework" />
            <handlers>
        </system.webServer>
        <staticFile expirationTime="-1.0:0:0" />
    </location>
</configuration>

EPiServer.Web.StaticFileHandler

The component that is responsible for delivering static files is the Web.StaticFileHandler class. It is possible to write an own custom static file handler (must implement System.Web.IHttpHandler) that can serve static files. For example, to add response headers an alternative is to let the custom handler extend Web.StaticFileHandler, for example, override the SetCachePolicy method to add response headers for VirtualFiles. To register a custom httpHandler it should be configured in the system.webServer/handlers section (either globally or for a specific location depending on the wanted scope).

See Also

  • The Caching section in the EPiServer CMS SDK
  • for more information on caching of page data, output, VPP, Dynamic Data Store (DDS) etc.

Comments