Cache Initialization Batch Jobs

Cache initialization batch jobs run on the cached catalog product relationship and make use of the productIds and promotion Ids. They also generate the cache data for the offer information, its eligibility for a given context, its pricing information, its hierarchy and promotional products linked to that promotion, some computed data such as bundles, promotional wrappers, and some metadata information to use by both GET and POST APIs.

Cache initialization batch jobs

Products can have different versions according to the version start and end dates, so there is a detailed offers listing that considers the versions of the products and the time frame for which that version is effective. Therefore, a batch job computes and caches that information. That information is worked upon by the cache initializing batch jobs and APIs to generate the relevant caches.

The Version Info Generator batch job caches the catalog products, promotions, and promotional item IDs that are used by all other Digital Commerce APIs and batch jobs as a snapshot of the offers listed under a catalog at any given time.

Version Info Generator Batch

With versioning enabled, the productId and promotional item IDs can be different over time, so this batch job gets the information about the product versions and promotional item versions falling in between the selected cache effective start and end dates. Using that information, this batch job divides the entire time frame into multiple time slices. For each time slice, there is only one version of any offer.

The time slices are disjointed sets of time frames having a start and end time where no two offer versions under a catalog overlap. At any given time, there is only have one version of an offer.

Version Info Generator Batch - Time Slices

In the above example, there are three products. The cache effective start time is March 1st and end time is March 31st. These are represented in the form of a timeline:

  • Product 1 has three versions: Version 1 ( - 3rd March), Version 2 (3rd March - 7th March), Version 3 (7th March - 31st March).

  • Product 2 has two versions: Version 1 (3rd March - 15th March), Version 2 (15th March - ).

  • Product 3 has three versions: Version 1, ( - 1st March), Version 2 (1st March - 15th March), Version 3 (15th March - 31st March).

To compute the time slices, the batch job takes each offer version falling in between the selected cache dates. Using the global group key of the product associated with the catalog by catalog product relationship, the batch job gets all the product versions where the corresponding version start date starts on or after the selected cache start date or version end date ends on or before the selected cache end date. In the above example, the versions Product 1 Version 1, Product 1 Version 3, Product 2 Version 1, Product 2 Version 2, Product 3 Version 2, and Product 3 Version 3 are considered. Product 3 Version1 is not considered because its version end date occurs before the cache start date.

The boundary of the cache entries are the selected cache start time and cache expiration time. The time slices are computed by taking the relevant product versions into consideration. In the above example, there are four-time slices generated between the selected date.

  • Time slice 1 (TS1) : 1st March - 3rd March

  • Time slice 2 (TS2) : 3rd March - 7th March

  • Time slice 3 (TS3) : 7th March - 15th March

  • Time slice 4 (TS4) : 15th March - 31st March

Version Info Generator Batch - Time Slices

For each time slice, there is a unique version of each product and no two product version dates intersect in any time slice. In the above example, for each time slice, product versions are as follows:

  • Time slice 1 (TS1): 1st March - 3rd March: Product 1 Version 1, Product 3 Version 2.

  • Time slice 2 (TS2): 3rd March - 7th March: Product 1 Version 2, Product 2 Version 1, Product 3 Version 2.

  • Time slice 3 (TS3): 7th March - 15th March: Product 1 Version 3, Product 2 Version 1, Product 3 Version 2.

  • Time slice 4 (TS4): 15th March - 31st March: Product 1 Version 3, Product 2 Version 2, Product 3 Version 3.

The processed information is then cached and the effectivity of the cache is according to time slice effectivity date. These time slices and the product version information in each time slice are cached and used by the subsequent batches and run-time APIs.

Other than the catalog product and promotions in the given time frame, there is more metadata information computed and cached by this batch job. The information cached by the Version Info Generator batch job is:

  • timesliceList: This type of cache holds information about the time slices for a catalog between given cache start and end dates. The cache key is formed with the hash of catalogCode and cache effective start and expiration time.

  • timeSliceInfo: This type of cache contains information about the offer versions that were effective between the time slice dates and is populated for each time slice. This is the snapshot of the catalog products, promotions, and promotion items.

  • versionInfoList: This cache contains the superset list of all the versions of products, promotions, and promotionItems for the selected catalog that occur between the selected cache start and expiration dates. This cache acts as a master list for the batch jobs that need the list of all the offerId versions associated with the catalog directly (as the catalog product relationship and promotional items) or indirectly (another version of the product queried using the global group key of the associated product).

  • versionInfo: This cache contains information about all the versions of an offer that were effective between the selected cache dates.