Introduced in Feature Pack 2

Setting up command caching for catalog filter

If your site uses catalog filters, you can set up command caching for catalog filter to help improve site performance.

Cacheable commands can eliminate much of the processor usage that is associated with running redundant database queries. Command Caching eliminates this usage by storing the results from earlier queries in a cache. With the WebSphere Commerce search feature enabled, catalog filter commands can compose search expressions to perform entitlement for users under different trading agreements. By adding command caching for catalog filters, the filtering search expression can be retrieved from the cache entry instead of from the database. This cache entry retrieval can improve response time and reduce system load.

Before you begin

Ensure that you are familiar with and understand the methods that are used to generate a key that is described in the following topic:

About this task

When you set up caching for catalog filter, you can add cache entries for the following catalog filter-related commands:
  • Feature Pack 4Feature Pack 2Feature Pack 3ResolveCatalogFilterSolrExpressionCmdImpl - This command accelerates the catalog filter-related entitlement check procedure. If your site uses WebSphere Commerce search and the Management Center catalog filter functionality, caching entries for this command can improve search performance. Caching entries for this command can also improve add to cart performance that performs entitlement checks before the process adds a product to a shopping cart.
  • Feature Pack 4Feature Pack 2Feature Pack 3ScheduledCatalogFilterImportCmdImpl - This command is a schedule command to import catalog filters with the Catalog Filter and Pricing tool or the Data Load utility. This command is triggered if your site imports catalog filter data into Management Center. The caching entry for this command is used to declare invalidation against catalog filters that are imported into Management Center with the Data Load utility or the Catalog Filter and Pricing tool. With this declaration all the cache entries for catalog filter commands are invalidated.
  • CalculateProductSetEntitlementCmdImpl - This command accelerates calculating entitlement check for product sets. Caching entries for this command can improve performance if your site uses WebSphere Commerce Accelerator product set based catalog filtering and not Management Center catalog filtering.

Procedure

  1. Open the sample cache configuration file cachespec.xml in the following directory:
    • WebSphere Commerce DeveloperWCDE_installdir/samples/dynacache/Contract
    • WebSphere Commerce EnterpriseWebSphere Commerce - ExpressWebSphere Commerce ProfessionalWC_installdir/samples/dynacache/Contract
  2. Copy all the cache entries from this sample cache configuration file.
  3. Open the cachespec.xml file that is found in the following directory:
    • WebSphere Commerce DeveloperWCDE_installdir/workspace/Stores/WebContent/WEB-INF/
    • WebSphere Commerce EnterpriseWebSphere Commerce - ExpressWebSphere Commerce ProfessionalWC_eardir/Stores.war/WEB-INF/
  4. Paste the cache entries from the sample cache configuration file to this cachespec.xml file.
  5. Feature Pack 4Feature Pack 2Feature Pack 3Add the following cache entries for the ResolveCatalogFilterSolrExpressionCmdImpl and ScheduledCatalogFilterImportCmdImpl commands to the cachespec.xml file.
    1. Open the cachespec.xml file that is found in the following directory if it is not already open:
      • WebSphere Commerce DeveloperWCDE_installdir/workspace/Stores/WebContent/WEB-INF
      • WebSphere Commerce EnterpriseWebSphere Commerce - ExpressWebSphere Commerce ProfessionalWC_eardir/Stores.war/WEB-INF
    2. Add the following cache entries to the file:
      <cache-entry>
       <class>command</class>
       <sharing-policy>not-shared</sharing-policy>
       <name>com.ibm.commerce.contract.catalogfilter.command.ResolveCatalogFilterSolrExpressionCmdImpl</name>
       <cache-id>
        <component type="method" id="getCatalogFilterId">
         <required>true</required>
        </component>
        <priority>1</priority>
        <timeout>86400</timeout>
       </cache-id>
       <dependency-id>catalogFilterId
        <component type="method" id="getCatalogFilterId">
         <required>true</required>
        </component>
       </dependency-id>
       <dependency-id>DC_catalogFilter</dependency-id>
      </cache-entry>
      <cache-entry>
       <class>command</class>
       <sharing-policy>not-shared</sharing-policy>
       <name>com.ibm.commerce.catalog.commands.ScheduledCatalogFilterImportCmdImpl</name>
       <invalidation>DC_catalogFilter</invalidation>
      	</cache-entry>	
  6. Save and close the cachespec.xml file.