A few things you didn’t know about Commerce Server’s Catalog Cache

One of the most important aspect of any e-commerce is their Catalog(s) and Commerce Server provides a system that allows customers to manage and organize their products. In any e-commerce site the most profile usage the Catalog. Searches and Catalog browsing constitutes about 70 percent or more of a site. Performance becomes an issue when you have to make that many round trip calls to the database. In order to minimize this you have to provide some mechanism for caching. Well as it happens Commerce Server's Catalog System has such a caching system.

Catalog Cache

Commerce Server's Catalog Cache is a lazy cache. If caching is turned on under the web.config in runtime scenarios then any request made is checked, if caching is on then we look into the cache and see if the object exists if not then a request is made to the database and the object is cached before returned to the caller.

Web.config Settings

The table below shows the cache settings for a Commerce Server site.

    <catalogSets defaultAnonymous="Anonymous User Default CatalogSet" defaultAuthenticated="Registered User Default CatalogSet"/>
    <cache enable="true" schemaTimeout="10" itemInformationCacheTimeout="10" itemHierarchyCacheTimeout="10" itemRelationshipsCacheTimeout="10" itemAssociationsCacheTimeout="10" catalogCollectionCacheTimeout="10"/>

As you can see caching is enabled and there are five items that can be cached. Instead of me explaining this which is already documented how about you do a bit of leg work. You can find more detailed info about these settings as well as the CacheConfiguration object here. Each item has a timeout period after which the item is dropped from cache.

Refreshing the Cache

Catalog Cache can be refreshed by using Catalog Manager, Staging Services or hitting a specific URL. This URL is protected and by default only administrators can access it. The URL is an httpHandler and this setting can also be found at the web.config.

    <add verb="*" path="SiteCacheRefresh.axd" type="Microsoft.CommerceServer.Runtime.SiteCacheRefresh, Microsoft.CommerceServer.Runtime, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35 "/>

To add an account that accesses this URL you must do so under the web.config.

<location path="SiteCacheRefresh.axd">
            <allow roles="BUILTIN\Administrators"/>
            <allow roles="VORDEFINIERT\Administratoren"/>
            <allow roles="BUILTIN\Administrateurs"/>
            <deny users="*"/>
            <deny users="?"/>

Cache Size

Commerce Server's Catalog items are typed DataSets and can be as large as 300KB per item. If you have a large Catalog the cache size can grow pretty big. To minimize this you can set the Cache Timeout to a smaller amount like 10 minutes. If I remember correctly this is the number of minutes that we tested the Commerce Server's Catalog Performance.

Where is the Cache?

Commerce Server utilizes ASP.NET cache. The following code will dump all the cache keys.

foreach (DictionaryEntry key in Cache)
    Response.Write("<br />");

The following is the cache out put from Starter Site.

Registered User Default CatalogSet
Adventure Works Catalog
Anonymous User Default CatalogSet
Adventure Works Catalog,Adventure Works Catalog,en-US,14,*,False
Adventure Works Catalog
Adventure Works Catalog,AW099-15,en-US,,,,,,
ctlg_QueryCatalogInfo|Adventure Works Catalog|AW099-15||en-US
Adventure Works Catalog,False,14,ProductCode,VariantCode,
Adventure Works Catalog,en-US,NoJoin,,,,P.BaseCatalogName,CategoryName,
Adventure Works Catalog,en-US
Adventure Works Catalog,en-US,False,NoJoin,,,,
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCategoryOID,Adventure Works Catalog,,en-US,,,,
Adventure Works Catalog,1,2147483646,,True,0,en-US
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCatalogSetInfoByName,Registered User Default CatalogSet
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCategoryOID,Adventure Works Catalog,,en-US,,,False,False
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCatalogProperties,Adventure Works Catalog,en-US,,
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetRootProducts,Adventure Works Catalog,en-US,False,NoJoin,,,,*,
Adventure Works Catalog,en-US,False,*,1,2147483646,,True,0
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCategoryProperties,Adventure Works Catalog,-1,
Adventure Works Catalog,en-US,BaseCatalogName,CategoryName,
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCatalogProperties,Adventure Works Catalog,,,
CS2007TRAINING,StarterSite_productcatalog,dbo.ctlg_GetCatalogSetInfoByName,Anonymous User Default CatalogSet

So here is something you may not have known

When you add an item to basket and execute the basket pipeline component there are two components that interact with the Catalog System QueryCatalogInfo and RequiredProdInfo. The QueryCatalogInfo is also dependant upon the cache values under the web.config. Why is that? The QueryCatalogInfo checks to make sure that the lineitems are in synch with the Catalog System and if not then marks them as deleted and the RequiredProdInfo removes the lineitem from the basket. The QueryCatalogInfo also keeps a cache of it's own separate from sites items cache. This increases the cache size and the same cache configuration values under the web.config are applied to the QueryCatalogInfo component cache.

As you can see there are two processes that depend on one configuration setting. under the "Where is the cache?" section in the second table, notice the red text that defines the QueryCatalogInfo cache item.

How to decouple this Configuration

There maybe scenarios that you will need to disable the Commerce Server's Cache as you may have implemented your own caching mechanism. Which means that by disabling the Commerce Server's Catalog Cache you will suffer performance hit in the checkout process.

The CacheConfiguration is passed as a context to the pipeline component so it's possible to disable the web.config Cache and create your own pipeline component that sets a cache settings for the QueryCatalogInfo component. Just make sure that this component is placed before the QueryCatalogInfo component.

The following code enables you to set your own cache settings.

public int Execute(object pdispOrder, object pdispContext, int lFlags)


CacheConfiguration cacheConfig = new CacheConfiguration();

    cacheConfig.CacheEnabled = true;

    cacheConfig.ItemInformationCacheTimeout = 10;

    ((IDictionary)pdispContext)["CatalogCacheConfiguration"] = cacheConfig;

return 1;



 This post was done with consultation of Ben Taylor from Shape Factory LTD in UK.

Comments (1)

  1. Wade Wegner says:

    There has been some excellent activity by some heavy-weights in the Commerce Server world. Sadly, I haven

Skip to main content