This section provides an introduction to the caching features and possibilities in EPiServer CMS.
The caching in EPiServer CMS is simple yet powerful. The robust content caching engine will manage caching across the web front end servers, minimizing the amount of communication with the database. The different cache methods can be applied to all the load balancing scenarios previously described. Furthermore, the cache is configurable and extendable.
IIS kernel caching is supported as well as cache expiration settings for files/resources/images, both those that are stored in the CMS and other resources used by the templates.
Automatically caches all objects in EPiServer CMS that is being requested from the API, via for example DataFactory (or IContentRepository). The object cache is based on the ASP.NET runtime cache and only read-only objects are stored to enable great performance. Invalidation is handled by an event system (described more the Framework SDK) with support for load balanced servers. The object cache can be used by custom classes, see CacheManager.
The most central implementation of the Object Cache is the cache for content instances, used for example via DataFactory (or IContentRepository). This cache has a few advanced charactaristics to improve scalability. For example it uses an optimistic locking approach when multiple threads are reading the same data they will all piggyback on the same database calls to avoid putting to much load on the database for "hot" objects that have not yet been cached.
This is an effective method since the entire rendered markup of a web page or user control will be cached for a specified duration. The cache is automatically invalidated when content in EPiServer CMS is updated. You can define dependency rules for the cache, as well as which parts of the website should be affected. The output caching in EPiServer is based on the standard ASP.NET Output Caching.
Rules for browser (client) caching can be easily configured in EPiServer CMS. For instance, you can set all static files delivered by the EPiServer CMS to be cached by the client for a certain time period. It is also possible to define how long dynamically generated pages should be cached on the client.
Files in EPiServer CMS are made available in the built-in file manager using the VPP technique. Files delivered from EPiServer CMS can be either client cached or server and client cached. The server cache uses the kernel cache available in IIS, which makes often requested files to be delivered directly by the IIS kernel which offer superior performance. The client cache let’s you for instance set a specific folder to be cached for a certain time period.
Dynamic Data Store Caching
Dynamic Data Store (DDS) utilizes a two level cache. The 1st level is a normal in memory collection of objects. These will reside in memory with the context until the context is no longer in scope. The 2nd level cache uses a provider model for maximum flexibility. EPiServer CMS provides a default ASP.NET runtime cache implementation to the DDS. Objects stored here are in "deconstructed" form, meaning they do not hold hard references to each other and may be invalidated from the cache individually, thereby maximizing cache efficiency. ASP.NET decides when and how objects are released from memory, if not removed by EPiServer CMS due to updates.
For more information about Dynamic Data Store functionality in the EPiServer CMS platform, refer to the Dynamic Data Store section of the EPiServer Framework SDK.
Static Files Caching
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. Use standard IIS settings to configure caching for static files.