caches Tag

The caches tag is a container element for cache tags that are used to configure CacheManager object-based caches in the application. The cache configuration supports a number of default configurations for advertising, discounts, and other common Commerce Server caches. In each case, the cache type has its own default options associated with it; however, the default options can be overridden.

The caches tag contains two tags: cache and config.

cache Tag

This tag defines the beginning of a new cache definition in the web.config file. It can be used both as a container and a marker element, depending on whether or not extended configuration settings (config tags) are required.

The following table lists the attributes of the cache tag.

Attribute Data Type Description
name String The name of the cache.

This attribute is required.

type String The type of cache to be configured. Valid values are: Advertising, Discounts, QCI, Tax, Shipping, and Custom. If a known type is specified, then default values are provided for all attributes. Each default value is described in the Cache Types section. The value type is Custom.

This attribute is optional.

loaderProgId String The COM ProgID of the object used for seeding the cache.

This attribute is required if the cache type is set to Custom.

writerProgId String The COM ProgID of the object used for writing cache changes to an external source.

This attribute is optional.

cacheObjectProgId String Used for specifying the object used as transient storage for cached data. The default value is Commerce.Dictionary.

This attribute is optional.

refreshInterval Integer The number of seconds until the cache expires and the loader is invoked to refill the cache. The default value is zero (0).

This attribute is optional.

retryInterval Integer The number of seconds the cache manager will wait before attempting to refill the cache if an error is encountered. The default value is 60.

This attribute is optional.

maxSize Integer Used only when the type attribute is set to Custom or QCI. If specified, the value is set in the CacheSize key of the Cache configuration dictionary used by the cache loader component as specified by the loaderProgId attribute.

This attribute is optional.

config Tag

This tag is used for setting arbitrary key/value pairs on the cache configuration dictionary. The cache configuration dictionary created by the runtime will be supplied to both the loader and writer components, and is used as both the LoaderConfig and the WriterConfig dictionary. If a cache has both loader and writer components and wants to provide distinct configuration, it must be done programmatically by accessing the CommerceCache instance in the CommerceCacheCollection created for the site.

If values for data types other than string need to be set, it must be done programmatically.

The following table lists the attributes of the config tag.

Attribute Data Type Description
key String A key name to set as part of the cache configuration.

This attribute is required.

value String The value for the specified key.

This attribute is required.

Cache Types

If a known type is specified for the type attribute, a set of default values for the configuration is provided. These default values can be overridden programmatically or by setting the values in the configuration itself.

Some of the Cache Types have a dependency on a specific Commerce Server resource. When the CommerceCacheModule creates the caches it also runs checks to ensure that all resource dependencies are satisfied. A CommerceResourceDependencyException is thrown if not.

The following tables list the default values for each configuration setting on a per-cache type basis.

Advertising

The advertising cache has a dependency on the Campaigns resource.

Attribute Value
loaderProgId Commerce.CSFLoadAdvertisements
writerProgId Commerce.CSFWriteEvents
refreshInterval 300
retryInterval 60

Discounts

The discounts cache has a dependency on the Campaigns resource.

Attribute Value
loaderProgId Commerce.CSFLoadDiscounts
writerProgId Commerce.CSFWriteEvents
refreshInterval 0
retryInterval 60

QCI

The QCI cache has a dependency on the Transactions Config resource.

Attribute Value
loaderProgID Commerce.LRUCacheFlush
writerProgID Null
refreshInterval 0
retryInterval 60
cacheObjectProgID Commerce.LRUCache

Shipping

The shipping cache has a dependency on the Transaction Config resource.

Attribute Value
loaderProgId Commerce.ShippingManagerCache
writerProgId None
refreshInterval 0
retryInterval 60

Tax

The tax cache has a dependency on the Transaction Config resource.

Attribute Value
loaderProgId Commerce.SampleRegionalTaxCache
writerProgId None
refreshInterval 0
retryInterval 60

Custom

Attribute Value
loaderProgId None
writerProgId None
refreshInterval 300
retryInterval 60

Example

<caches>
      <cache name="name"
             type="Advertising|Discounts|QCI|Shipping|Tax|Custom"
             loaderProgId="progid"
             writerProgId="progid"
             cacheObjectProgId="progid"
             refreshInterval="0"
             retryInterval="60"
             maxSize="10">

             <config key="key" value="value" />
      </cache>
</caches>

See Also

Configuration Services

CommerceCache Class

CommerceCacheModule Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.