At times, changing the metadata (removing old fields, creating new fields, changing a User profile) may lower the performance of the application or display errors due the API Cache referring to the old fields as they are unavailable. To avoid this from happening, you may need to clear the API Cache from time to time for better performance. You can clear the cache in two ways:

  • Use the Clear API Cache button on the Storefront record
  • Schedule a batch job

To clear API cache from the Storefront

  1. Click All tabs and click Storefronts.

  2. Select your Storefront from the available list.

  3. Click the Clear API Cache button. The API Cache clearing process begins. An apex job is triggered to clear the cache records related to the selected storefront.

  4. After the cache is cleared, the remaining cache data is displayed in the Cache Size field on the Storefront record.

To schedule a batch job to delete cache records

  1. Go to Setup and in the Quick Find box, type apex class.
  2. Click Apex Classes.
  3. Click the Schedule Apex button.
  4. In Job Name, type a unique name. For example, Schecdule job to clear api cache.
  5. In Apex Class, search and select DCClearCacheDispatcher.

  6. From the Schedule Apex Execution section, set the frequency as below:
    1. Select Weekly and select all the 7 days of the week.
    2. Specify a Start date.
    3. Specify an End date
    4. From the Preferred Start Time, set the time for 24 hrs. For example, 12:00 AM.
  7. Click Save.

This scheduled job executes every 24 hours looking for any profile changes in the last 24 hours and deletes any APICache records associated to those profiles.