Hide menu Last updated: Mar 31 2014


This section provides an introduction to the specific caching features and possibilities in EPiServer Commerce, including Commerce-specific caching and examples of how EPiServer Commerce uses caching for its product catalogs and their entries. Platform cache functionality, including remote synchronization, is part of the EPiServer platform. Refer to the Caching section in the EPiServer CMS SDK for more information.

Classes referred to here are available in the following namespaces:

Subsystem caching

Caching for each subsystem such as catalogs and orders, is configured in their respective configuration files. For catalogs for example, you will want to refer to ecf.catalog.config in the configs folder of the site.

Example: cache settings for the Catalogs subsystem

<Cache enabled="true" collectionTimeout="0:1:0" entryTimeout="0:1:0"nodeTimeout="0:1:0" schemaTimeout="0:2:0"/>

The collectionTimeout responds to an entry array, and "entry" responds to a single entry. What is actually cached is the CatalogEntryDto, and since the Entry object is created from the DTO, the DTO is what we will cache to here. In some cases, the entry objects themselves can also be cached rather than the DTO.

Cache invalidation

In the catalog example, the cache is invalidated when it reaches the cache timeout specified above for the request type. It can also be invalidated if the entire catalog cache is cleared by calling CatalogCache.Clear(). Another way to invalidate for a specific entry, is to remove the key using CatalogCache.Remove(key). When calling CatalogContext.SaveCatalogEntry, it will then automatically remove the entry from the different cache keys by calling the below.

CatalogCache.RemoveByPattern("^" + CatalogCache.CreateCacheKey("catalogentry"));
        CatalogCache.RemoveByPattern("^" + CatalogCache.CreateCacheKey("catalogentries"));
        CatalogCache.RemoveByPattern("^" + CatalogCache.CreateCacheKey("catalogitems"));

When running on multiple servers, only the local cache of a specific server will be invalidated.

See also

  • Configuration section in this documentation, for more information on configuration files in EPiServer Commerce.
  • The Caching section in the EPiServer CMS SDK.