Sitecore Experience Commerce

Caching

Sitecore XC 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:

  • CommerceTerms – caches CommerceTerms from the Control Panel.

  • Customer.All – caches loaded Customers, if this cache is enabled.

  • EntityCache – caches loaded CommerceEntities.

  • FulfillmentOptions– caches the list of Fulfillment Options from the Control Panel.

  • 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.

  • PolicySet – caches any PolicySets that are loaded.

  • Promotions.All – caches loaded Promotions, if this cache is enabled.

  • SitecoreItemsByPath – caches a call to Sitecore to retrieve all the items in a particular path.

  • ViewTerms – caches the ViewTerms from the Control Panel.

Caching is administered using the CommerceOps API. API actions call GetCacheStoresCommand, which in turn calls GetCacheStoresPipeline.

The 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.

    For 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 if 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

Priorityr

string

The priority for the entity in the cache (Normal/High).

Normal

N

Expiration

long

Time until the entity expires from the cache, in milliseconds.

60000

N