Sitecore Commerce caching
Configure Sitecore Commerce caching to optimize system performance. Sitecore Commerce uses the core libraries of the Sitecore caching framework and Entity Memory Caching.
A cache store may be defined for each Commerce Environment. This allows caching to be cleared for a specific environment without affecting others. Cache stores are instantiated when the environment starts up. The cache store for an environment includes the following caches:
EntityCache
- caches loaded CommerceEntities
SitecoreItemsByPath
- caches a call to Sitecore to retrieve all the items in a particular path
ItemModel
- caches loading of the ItemModel
LocalizedMessages
– caches the loading of localized messaging from Sitecore Items in the Control Panel
PaymentOptions
- caches the list of Payment Options from the Control Panel
FulfillmentOptions
- caches the list of Fulfillment Options from the Control Panel
CsProducts
- caches Commerce Server products
CatalogsDataSet
- caches the Catalogs dataset from Commerce Server
ProductCatalog
- caches the ProductCatalog from Commerce Server
ViewTerms
- caches the ViewTerms from the Control Panel
PolicySet
- caches any PolicySets that are loaded
CommerceServerObjects
– caches any loaded Commerce Server objects
CommerceTerms
- caches CommerceTerms from the Control Panel
Promotions.All
- caches loaded Promotions, if this cache is enabled
Customer.All
- caches loaded Customers, if this cache is enabled
Caching is administered using the CommerceOps API. API actions call GetCacheStoresCommand
which in turn calls GetCacheStoresPipeline
. API actions on cache stores include:
Get Cache Stores
- retrieves a list of all instantiated cache stores. For example (GET): http://{{ServiceHost}}/{{OpsApi}}/GetCacheStores()
Get Cache Store
– retrieves a specified cache store. For example (GET):
http://{{ServiceHost}}/{{OpsApi}}/GetCacheStore(name='{{CacheStoreName}}') Clear Cache Store – clears a specified cache store. Example (PUT): http://{{ServiceHost}}/{{OpsApi}}/ClearCacheStore() Body: { "cacheStoreName": "{{CacheStoreName}}" }
Entity Memory Caching adds the ability to cache entities in memory. For any given entity in the system, caching policies define whether an entity can be cached in memory, its caching priority, and its caching expiration.
Property | Type | Description | Default | Required |
EntityFullName | string | The fully qualified name of the entity | "" | Y |
AllowCaching | bool | Whether the entity may be cached in memory | True | N |
Priority | string | The priority for the entity in the cache (Normal/High) | Normal | N |
Expiration | long | Time until the entity expires from the cache (milliseconds) | 60000 | N |