ccrz.ccApiPrivateCache.fetch

Executes a SOQL query of cached data by storefront, page, or locale, and returns the matching cache content as a String.

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

You can still call older versions of the API for this method, which can accept different input keys or return different output keys. Any differences in behavior for older versions aren't documented in this topic.

Note

Signature

global static Map<String, Object> fetch(Map<String, Object>)

Service Layer Classes

This method doesn't support service layer extensions or overrides.

Inputs (Required)

Map<String, Object> that must include the following required keys:

ccrz.ccApi.API_VERSION
The version of the B2B Commerce for Visualforce API to reference for the method call. We recommend that you use the ccrz.ccApi.CURRENT_VERSION constant whenever possible, and only reference a specific version for compatibility if necessary.

If this key isn't specified, the method returns a ccrz.ccApi.NoApiVersionException.

Note

ccrz.ccApiPrivateCache.CACHE_NAME
String that specifies a Cache Name for the private cache records to query, such as ccConfig.
ccrz.ccApiPrivateCache.CACHE_NAME => 'ccConfig'

If this key isn't specified, the method returns a ccrz.ccApiPrivateCache.NoCacheNameException.

Note

Inputs (Optional)

The input map can also include the following keys:

ccrz.ccApiPrivateCache.LOCALE
String that specifies a locale to filter the queried cached data by.

If cached data isn't available for the specified locale, the method falls back to query other locales with the same language component. For example, maybe you specify en_US but cached data isn't available for that locale. The method then queries for cached data from any locale that starts with en, such as en_GB or en_AU.

Note

ccrz.ccApiPrivateCache.PAGENAME
String that specifies the name of a page whose cached data you want to query. Use the page keys defined in CC Admin global settings, such as hp for Home page and plp for Product List page.
ccrz.ccApiPrivateCache.PAGENAME => 'hp'

To query cached data from all pages, specify All. If you don't include this key in your input map, the method uses All by default.

ccrz.ccApiPrivateCache.PAGENAME => 'All'
ccrz.ccApiPrivateCache.STORE_NAME
String that specifies a storefront whose cached data you want to query.
ccrz.ccApiPrivateCache.STORE_NAME => 'DefaultStore'

To query cached data from all storefronts, specify Global. If you don't include this key in your input map, the method uses Global by default.

ccrz.ccApiPrivateCache.STORE_NAME => 'Global'

Fallback Behavior

Depending on which values you include in the input map, this method incrementally falls back to a less specific query, in the following order of priority.

The Sequence Priority field on a private cache record specifies the relative priority of that record in query results.

Note

Priority ccrz.ccApiPrivateCache.STORE_NAME Value ccrz.ccApiPrivate.PAGENAME Value ccrz.ccApiPrivateCache.LOCALE Value
1 The exact value specified The exact value specified The exact value specified
2 The exact value specified The exact value specified Any locale with the same language component
3 The exact value specified The exact value specified None
4 The exact value specified All The exact value specified
5 The exact value specified All Any locale with the same language component
6 The exact value specified All None
7 Global The exact value specified The exact value specified
8 Global The exact value specified Any locale with the same language component
9 Global The exact value specified None
10 Global All The exact value specified
11 Global All Any locale with the same language component
12 Global All None

Outputs

Map<String, Object> that can include the following keys:

ccrz.ccApi.API_VERSION
Integer that indicates which API version was used for the query.
ccrz.ccApi.SUCCESS
Boolean
Value Usage
true The call completed.
false The call encountered errors.

B2B Commerce for Visualforce doesn't always return an exception for any errors that can occur. When this value is false, consider rolling back the API transaction to a previous savepoint.

Tip

ccrz.ccApiPrivateCache.CONTENT
String of the cached data that matches the query.