Affected Cache API

The Get Affected Cache API gets the cached records affected by the derived cachedAPIChange objects received from the Derive Change Entities API.

This API takes the derived cachedAPIchange Ids as input and maps them to the cachedAPIResponse entries that are affected by the derived Ids. The system internally creates a cachedAPIChangeEntry using the Id of the cachedAPIchange object passed in the input and the affected response from the CachedAPIResponse object. If you add a new offer, then there are no cachedAPIResponse objects present and no entities in CachedAPIResponse object are affected. In this case, the cacheKey field of CachedAPIChangeEntry object would be null.

The default value of the CacheAPI.RegenerateBasket custom setting is regenerate. This setting specifies whether to invalidate or regenerate the Digital Commerce API basket cache as part of the regenerate process. You can set this to invalidate only the basket records and not regenerate them.

For example, if you have made a pricing change and computed the impacted entities from the Derive Change Entities API, then posting this change determines which cached records have been impacted due to this derivation (regeneration case).

You can obtain the List<cachedAPIChangeIds> or cachedAPIChangeIds required in the request body of this API from the cachedAPIChangeIds node in the response body of the Derive Change Entities API.

There are up to three different API calls provided by the action nodes of this API's response. They are:

  • invalidateAction (required): Invalidates the cache entries that have become inaccurate due to catalog offer changes. You must pass the cachedAPIResponseIds provided in the invalidateAction node received in the response from Get Affected Cache.

    For example: POST /services/apexrest/vlocity_cmt/v3/admin/catalogs/regenerate/invalidate?expirationTime=2021-08-24T12:08:56

    If you run the invalidateAction then call regenerateAction while the parameter is set to invalidateAction, the cache is left in an invalidated state.

  • generateAction: This call is required if the generateAction node is present in the response from Get Affected Cache. If you have at least one offer availability change based on the response you received from the Get Affected Cache, then you must execute certain populate cache APIs again using the catalog codes provided in the response. For example, you may receive the generateAction asking you to perform five of the populate cache APIs with the catalog code AS_hierarchywithpromotion.

  • regenerateAction: If you receive regenerateAction nodes in your response from GetAffectedCache, then you must execute an API call for each node in the chronological sequence provided, for example, perform the node with Sequence 8, followed by the node with Sequence 9, etc. You must append the ChangeEntryId parameter and its provided value to the URI.

    For example: POST /v3/admin/catalogs/{value}/offers/{value}/{APIname}?ChangeEntryId={value}

These three API calls must be executed with the invalidateAction calls first, followed by the generateAction calls, and finally the regenerateAction calls. In some cases, you do not need to perform generateAction calls, and you do not receive a corresponding node.



You can make this cache effective from a future date using the cacheEffectiveStartTime parameter. Here is an example of how to use it:

cacheEffectiveStartTime2021-08-24T12:08:56NullOptionalThis parameter is for future-dated cache. The format is YYYY-MM-DDThh:mm
ParameterData TypeDescriptionOptional/Required
cachedAPIChangeIdsStringUnprocessed cachedAPIChange Ids are the output of the Derive Change Entities APIDerive Change Entities API,Required

This is a sample post for cachedAPIChangeIds.

cachedAPIChangeIds contain derived Ids from the cached API change object, which could be a list of changes.

This is sample input for cachedAPIChangeIds.

This is an example of how you invoke the API using Apex:

You can run this API in parallel for different cachedAPIChangeIds. For example, if there are 100 unprocessed cachedAPIChange entries from the DeriveChangeAPI (CAC1, CAC2.....CAC100), you can run parallel threads of the Derive Change API with each individual cachedAPIChangeIds.


The return status indicates success or failure with a reason for the error. List<Records> may include records that could be a generateAction, regenerateAction, or invalidateAction node.

500Internal Server Error