---
schema_version: "1"
id: 735d1ebc2a8a21b9d9c42843c45ab935708a7adac17427fa51c9c5bd4f77c296
title: Optimize the Cache Catalog Product Definition Job
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-run-cache-catalog-product-definition-job-in-parts.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-run-cache-catalog-product-definition-job-in-parts.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 56172cf304cdc1ecacff5ce5548779cfa65066c2da01b25ef05ce5107e18e1fe
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Optimize the Cache Catalog Product Definition Job

Use the Cache Management API to speed up the Cache Catalog Product Definition job.

If your org is running the CME 240.9 package, run the following prerequisite steps:

1.  Create the following Apex class. For information on creating Apex classes, see [Define Apex Classes](https://help.salesforce.com/s/articleView?id=sf.code_define_package.htm&type=5).

    ```
    global class CustomCacheDataImplementation implements vlocity_cmt.VlocityOpenInterface
    {
        private vlocity_cmt.VOIInvoker invoker = vlocity_cmt.VOIInvoker.getInstance();
        private vlocity_cmt.VlocityOpenInterface voi = (vlocity_cmt.VlocityOpenInterface)invoker.invoke('DefaultGetCacheDataImplementation', 'debugCreate', null, null, null);

        global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options)
        {
            normalizeApiName();
            voi.invokeMethod(methodName ,input, output, options);
            return true;
        }

        private void normalizeApiName()
        {
            if(vlocity_cmt.FlowStaticMap.flowMap.get('apiName') != null)
            {
                String apiName = (String) vlocity_cmt.FlowStaticMap.flowMap.get('apiName');
                switch on apiName
                {
                    when 'getOffers'{
                        vlocity_cmt.FlowStaticMap.flowMap.put('apiName','GetOffers');
                    }

                    when 'getOfferDetails' {
                        vlocity_cmt.FlowStaticMap.flowMap.put('apiName','GetOfferDetails');
                    }

                    when 'getContainOffers'{
                        vlocity_cmt.FlowStaticMap.flowMap.put('apiName','GetContainOffers');
                    }
                }
            }
        }
    }
    ```

2.  Create an Interface Implementation.

    - Interface Name: `GetCacheData`

    - Active Implementation Class: `CustomCacheDataImplementation`

3.  For the Interface Implementation, create an Interface Implementation Detail with the Available Implementation of `CustomCacheDataImplementation`.

Optimize the Cache Catalog Product Definition job.

1.  Click the ![Gear](https://developer.salesforce.com/docs/media/gear_1.png) icon and then **Developer Console**.

2.  Create a configuration snapshot.

    ```
    vlocity_cmt.TelcoAdminConsoleController controller = new vlocity_cmt.TelcoAdminConsoleController();
    Map<String, String> input = new Map<String, String>();
    input.put('startDateTime', DateTime.now().format());
    input.put('endDateTime', DateTime.now().addDays(30).format());
    controller.invokeMethod('createConfigurationSnapshot',input);
    ```

3.  Populate the cache for the getOfferDetails and getOffersByCatalogCodeAPIs by running steps 1 - 8 in [Workflow for Using the Cache Management API Sample Orchestrator](https://developer.salesforce.com/docs/industries/cme/guide/comms-t-workflow-for-using-the-cache-management-api-sample-orchestrator-.md).

4.  Activate the configuration snapshot.

    ```
    vlocity_cmt.TelcoAdminConsoleController controller = new vlocity_cmt.TelcoAdminConsoleController();
    Map<String, String> input = new Map<String, String>();
    controller.invokeMethod('activateConfigurationSnapshot',input);
    ```

    If you see any errors when populating the cache, you can abort the process.

    ```
    vlocity_cmt.TelcoAdminConsoleController controller = new vlocity_cmt.TelcoAdminConsoleController();
    Map<String, String> input = new Map<String, String>();
    controller.invokeMethod('abortConfigurationSnapshot',input);
    ```

**important:** To optimize the Cache Catalog Product Definition Job's operation and prevent any errors, it is recommended to ensure that all promotions in the catalog are active and orderable.
