Inventory cache configuration and implications

When WebSphere Commerce is used with an external Distributed Order Management (DOM) system, WebSphere Commerce starts an outbound call to retrieve the inventory data. To reduce the performance usage, WebSphere Commerce must cache the data from the external DOM system.

To cache the data in WebSphere Commerce, you must first configure and enable the cache. You can configure two types of cache, the database cache and the memory cache. The configuration data for these two types of cache is in the INVCNF and the INVCNFREL tables.

Memory cache

You can enable the memory cache in both of the INVCNF and INVCNF tables. The INVCNF table defines how the inventory cache behaves. In the INVCNF table, the bitwise field FLAGS decide which type of cache is used and how it is used. The memory cache starts working when the first bit is set to 00000001. If you want both the memory cache and the database cache to work, you must set the bit at 00000011. For more information about bits, see: INVCNF.

Database cache

In the INVCNF table, the bitwise field FLAGS decide which type of cache is used and how it is used. To enable the database cache, the second bit must be set to 00000010. If you want both the memory cache and the database cache that is enabled, you must set the bit at 00000011. For more information about bits, see: INVCNF.

The INVCNF table and inventory cache
Aside from configuring the memory and database caches, the INVCNF table defines how the inventory cache behaves:
  • You can define different cache behaviors for items that have either a low level or high level of inventory. For items that have high inventory, the buffer for data inaccuracy is higher, and the system can rely on the caching. For items that have low inventory, it is safer to call the external inventory system to avoid any overselling. Using the THRESHOLDQUANTITY field, you can define the threshold for the accuracy of the data, and when the cache becomes sensitive.
  • The CHEXPABOVETHRES field defines the cache expiration interval, in seconds, when the current inventory quantity is cached, minus any requested quantity that is above the threshold quantity.
  • The CHEXPBELOWTHRES field defines the cache expiration interval, in seconds, for when the current inventory quantity is cached, minus any requested quantity, is below the threshold quantity. For an inventory cache entry, if time is elapsed since the INVAVL.LASTUPDATE value, the entry is expired.
  • The fallback configuration defines the inventory behavior when WebSphere Commerce is unable to contact the external inventory system. WebSphere Commerce sets the inventory status of the requested item to the value in the FALLBACKINVSTAT field, the available date to the value in the FALLBACKAVAILTIME field, and the availability that is offset in seconds to the value of the FALLBACKINVOFFSET field.
The INVCNFREL table defines the scope of an entry in the INVCNF table:
  • The whole site
  • An online store
  • A physical store
  • A specific catalog entry
In the INVCNFREL table, Y= not null, and N= null.
Table 1. INVCNFREL table
CATENTRY_ID STORE_ID STLOC_ID Scope
Y Y N The catalog entry for the online store.
N Y The catalog entry for the physical store.
N N The catalog entry for any store.
N Y N Any catalog entry for the online store.
N Y Any catalog entry for the physical store.
N N Any catalog entry for any store.

There are overlapping between the two tables, so multiple INVCNF entries can be applicable to the same catalog entry. For example, a product can be listed in the catalog entry scope and the physical store scope. In this case, the entry with the largest INVCNF.PRECEDENCE is applied. If the PRECEDENCE value is set on all entries as equal, then it is unpredictable to know which entry is applied.

For items that are on sale, and you expect a high amount to be purchased, then it is called a high velocity item. For a high velocity item, create a separate INVCNF record, where the THRESHOLDQUANTITY must be put at a large number, and the CHEXPBELOWTHRES must be a low number, or zero. A low number, or zero means that there is no caching, and the number in inventory is accurate. If PRECEDENCE is set to a higher value, it overrides any other INVCNF records that also might apply to the catalog entry.