Caching price list headers and pricing rules

When items are being added to a cart, price list headers and pricing rules associated with the items are repeatedly fetched from a database. To increase performance, price list headers and pricing rules are cached by default into Java Virtual Memory (JVM) at server startup. During runtime, instead of querying the database, these rules are fetched from cache.

You can change the caching properties by modifying the values of the properties yfs.ItemProperties.cache*, yfs.pricelistheader.cache* and yfs.promotionrules.cache* properties.

During JVM startup, all pricing rules that are present in the database and active for the current 72-hour period are fetched by running queries against the database. The 72-hour period starts at the beginning of the previous day and ends the next day, to cover potential time zone differences among stores. When the day changes, the cache is refreshed. Rules stop being loaded into cache if the total number of rules in the data base is above the limit set in the property yfs.promotionrules.cache.maxsize.toload. This prevents loading the cache with too many records and causing out-of-memory exceptions.

The cache is used only if the pricing date for the order is the same as the date when the pricing rules were loaded. With each new day, the first order reloads cache for the current 72-hour period.

Note: The caching properties are applicable for application server JVMs only and not for agent servers.