Catalog Caching for Solution Sites

All of the catalog caches are initialized in an identical fashion. Most of them are used to store HTML fragments. Based on your scenario you may want to adjust cache sizes or other attributes to enhance the performance of your application. Details for performance tuning are beyond the scope of this document. For more information about performance tuning, see Optimizing Commerce Server.

Initialization

The following code, from the InitCacheManager function with additional comments, shows how the cache ProductListCache is created in the Solution Sites:

'Create the configuration dictionary for the cache loader.
      Set dictProductListCacheConfig = GetDictionary()

'Get the connection string from the configuration dictionary.
    dictProductListCacheConfig("ConnectionString") = _
       dictConfig.s_TransactionConfigConnectionString

'Set cache size, this is the number of items in the cache. 
'It is not related to the size of the items.
    dictProductListCacheConfig("CacheSize") = 10000

'Set the name of the table used to provide information to Business Desk.
    dictProductListCacheConfig("TableName") = _
        "CatalogCache_Virtual_Directory"

'CacheName is one of the fields inserted in the above table.
'It also is used in BDRefresh.asp to trigger 
'refreshing all catalog caches.
    dictProductListCacheConfig("CacheName") = "CatalogCache"
'Machine Base URL, to be inserted in the above table.
    dictProductListCacheConfig("AppUrl") = sMachineBaseURL
...
' Configure CacheManager For ProductList Fragment Caching.
'Setting RefreshInterval to 0 disables automatic refresh.
    oCacheManager.RefreshInterval("ProductListCache") = 0
'RetryInterval in seconds.
    oCacheManager.RetryInterval("ProductListCache") = 5 * 60
'Use an LRUCache object for the cache.
    oCacheManager.CacheObjectProgId("ProductListCache") = _
        "Commerce.LRUCache"
    oCacheManager.LoaderProgId("ProductListCache") = _
        "Commerce.LRUCacheFlush"
'Reference the dictionary created above for configuration data.
    Set oCacheManager.LoaderConfig("ProductListCache") = _
        dictProductListCacheConfig

Using Caches

The Solution Sites use four wrapper routines to simplify moving items in or out of the catalog caches.

CacheFragment

CacheObject

LookupCachedFragment

LookupCachedObject

Ee797316.note(en-US,CS.20).gif Note

  • These routines expect an LRUCache object name, and will not work with a dictionary object name.

During site development it can be useful to disable caching. When troubleshooting caching problems it can be useful know whether a particular item was cached. There is commented debug code in the LookupCachedFragment function to show if a fragment was cached.

Individual Caches

There are six caches, not counting search caches, that are related to the catalog. The search caches are discussed in Search Caching for Solution Sites.

ProductListCache

QueryCatalogInfoCache

DiscountProductInfo

DefaultPageCache

ProductPageCache

StaticSectionsCache

ProductListCache

The cache ProductListCache is used to store product list HTML fragments on the category.asp page. It is referenced in the htmCategoryHTML and htmCachedProductList functions.

QueryCatalogInfoCache

The cache QueryCatalogInfoCache is used by the QueryCatalogInfo pipeline component. For more information, see QueryCatalogInfo. The Commerce Server 2002 QueryCatalogInfo pipeline component expects a cache of this name.

DiscountProductInfo

The discountProductInfo cache is used to store SimpleList objects containing product information on the template\discount.asp helper page. It is referenced in the GetShownProductsDetails and oCachedDiscountProductInfo functions.

DefaultPageCache

The DefaultPageCache cache is used to store the HTML for the user's default page on the default.asp page. It is referenced in the Main (default.asp) function on the page and in the htmRenderDefaultPage function.

ProductPageCache

The cache ProductPageCache is used to store product page HTML on the product.asp page. It is referenced in the Main (product.asp) function.

StaticSectionsCache

The cache StaticSectionsCache is used to store a variety of miscellaneous HTML fragments on the site. The following are examples of pages that reference the cache StaticSectionsCache:

See Also

Search Caching for Solution Sites

Optimizing Commerce Server

Copyright © 2005 Microsoft Corporation.
All rights reserved.