Lifecycle of Storable Actions

This image describes the sequence of callback execution for storable actions.
Note

Note

An action might have its callback invoked more than once:

  • First with the cached response, if it’s in storage.
  • Second with updated data from the server, if the stored response has exceeded the time to refresh entries.

Storable Action Lifecycle

Cache Miss

If the action is not a cache hit as it doesn’t match a storage entry:

  1. The action is sent to the server-side controller.
  2. If the response is SUCCESS, the response is added to storage.
  3. The callback in the client-side controller is executed.

Cache Hit

If the action is a cache hit as it matches a storage entry:

  1. The callback in the client-side controller is executed with the cached action response.
  2. If the response has been cached for longer than the refresh time, the storage entry is refreshed.

    When an application enables storable actions, a refresh time is configured. The refresh time is the duration in seconds before an entry is refreshed in storage. The refresh time is automatically configured in Lightning Experience and Salesforce1.

  3. The action is sent to the server-side controller.
  4. If the response is SUCCESS, the response is added to storage.
  5. If the refreshed response is different from the cached response, the callback in the client-side controller is executed for a second time.