This topic describes 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. See also the Caching section in the Episerver CMS Developer Guide.
Classes in this topic are in the Mediachase.Commerce.Catalog namespace.
Caching for each subsystem, such as catalogs and orders, is configured in their respective configuration files. For catalogs for example, see 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, because the Entry object is created from the Data Transfer Object (DTO), you cache the DTO. In some cases, you also can cache the entry objects themselves rather than the DTO.
In the Catalogs subsystem example, the cache is invalidated when it reaches the cache timeout specified above (0:1:0) for the request type. You also can invalidate it if the entire catalog cache is cleared by calling CatalogCache.Clear(), which is automatically called when you call CatalogContext.SaveCatalogEntry.