HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Cache options and methods

Explains the caching concept in the Optimizely platform, and the different caching options and methods available.

Cache options

Optimizely, the Content Management System (CMS) supports external caching and cache expiration settings for files, resources, and images and manages caching across the web front-end servers, minimizing the amount of communication with the database. CMS stores the cache and other resources (used by the templates) in the CMS. You can configure and extend the cache. CMS supports the caching methods listed below.

Object cache

CMS automatically caches objects requested from the API, such as content instances. The object cache is an in-memory cache and stores only read-only objects for better performance. An event system manages invalidation with support for load-balanced servers.

This cache improves scalability with an optimistic locking approach. When multiple threads read the same data, they attach to the same database calls to avoid putting too much load on the database for objects that are not yet cached. See Object caching.

Output cache

CMS has no built-in output caching of HTML responses. See Response caching on how to add response caching for an ASP.NET Core application.

📘

Note

Adding response caching of may cause a stale response to be delivered.

Using response caching may cause contents to not update instantly after publishing from CMS, and causes differences among web instances of a load-balanced environment.
Response caching should not be used if you have Html.RenderEPiServerQuickNavigatorAsync() in Razor view.

Browser cache

You can configure rules for browser (client) caching. For example, you can set a time period in which the client caches static files delivered by the CMS. You also can define how long dynamically generated pages are cached on the client.

File cache

You can configure content media cache headers through EPiServer.Framework.MediaOptions.

Static file cache

The static file middleware serves static files. To control the caching of these files, see Set HTTP response headers.

Dynamic Data Store cache

Dynamic Data Store (DDS) offers an API and infrastructure for the saving, loading, and searching of both compile-time data types (.NET object instances) and runtime data types (property bags).

DDS uses a two-level cache:

  • The first level cache is a normal collection of objects that reside in memory with the context until the context is no longer in scope.
  • The second level cache provides a default in-memory cache implementation to the DDS. Objects are in deconstructed form, meaning they do not hold hard references to each other and may be invalidated from the cache individually, maximizing cache efficiency. The used in-memory decides when and how it releases objects from memory if CMS does not remove them due to updates.