ccrz.ccPageLabelCacheBuildJob

Builds a cache of page label data for specific storefronts, pages, and locales. This class is called from the ccrz.ccPageLabelCacheBuilder.build method, which extends the base ccrz.ccCacheBuilder.build method.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Logic Performed

For each combination of storefronts, pages, and locales in a batch, this class completes the following actions:

  1. Calls the ccrz.ccApiI18N.fetchPageLabels global API method.
  2. Parses the ccrz.ccApiI18N.fetchPageLabels return data for the ccrz.ccApiI18N.PAGE_LABELS output.
  3. Calls the ccrz.ccApiPublicCache.startWrite global API method to initiate the cache build, with the following inputs:
    ccrz.ccApiPublicCache.startWrite Key Value
    ccrz.ccApiPublicCache.BUILD_GROUP The Salesforce ID of the batch job.
    ccrz.ccApiPublicCache.CACHE_NAME ccrz.ccPageLabelCacheBuilder.CACHE_NAME, which is always ccPageLabel.
    ccrz.ccApiPublicCache.PAGENAME The storefront page for the current batch scope.
  4. Calls the ccrz.ccApiPublicCache.appendTo global API method to add the ccrz.ccApiI18N.PAGE_LABELS data to the cache entry.
  5. Calls the ccrz.ccApiPublicCache.close global API method.

When the batch job completes, the ccrz.ccPageLabelCacheBuilder.disableOld method executes. This method ensures that only a single page label cache entry is enabled at one time for each combination of storefront, page, and locale.

Constructors

This class defines the following constructors:

ccrz.ccPageLabelCacheBuildJob(final Set<Object> storefronts, final Set<Object> pages, final Set<Object> locales, final Map<String, Object> inputData)
Constructor that takes:
  • A set of storefronts to iterate over in the batch.
  • A set of storefront pages.
  • A set of locales.
  • General input data that's passed to both the ccrz.ccPageLabelCacheBuilder.disableOld and ccrz.ccPageLabelCacheBuilder.cleanup methods.

Limits

This job doesn’t support a combination of storefront name, page name, or locale values that exceeds 130,000 characters. This limit is the maximum length of the ccrz__Content__c field on the ccrz__E_PublicCacheContent__c object.

To verify the length of a particular combination of values, execute the following Anonymous Apex code from the Developer Console:

Map<String,Object> pageLabelRet = ccrz.ccApiI18N.fetchPageLabels(new Map<String,Object>{
    ccrz.ccApi.API_VERSION => ccrz.ccAPI.CURRENT_VERSION,
    ccrz.ccApiI18N.STORE_NAME => 'storefront',
    ccrz.ccApiI18N.PAGE_NAME => 'pagename',
    ccrz.ccApiI18N.LOCALE => 'locale',
    ccrz.ccApiI18N.USE_CACHE => false,
    ccrz.ccApiI18N.RETURN_SERIAL => true
});
String pageLabels = (String) pageLabelRet.get('pageLabels');
System.debug(pageLabels.length());