Newer Version Available

This content describes an older version of this product. View Latest

Enable Storable Actions in an Application

To use storable actions in a standalone app (.app resource), you must configure client-side storage for cached action responses.

Client-side storage is automatically configured in Lightning Experience and the Salesforce mobile app. A component shouldn’t assume a cache duration because it may change as we optimize the platform.

Note

To configure client-side storage for your standalone app, use <auraStorage:init> in the auraPreInitBlock attribute of your application’s template. For example:

1<aura:component isTemplate="true" extends="aura:template">
2    <aura:set attribute="auraPreInitBlock">
3        <auraStorage:init
4          name="actions"
5          persistent="false"
6          secure="true"
7          maxSize="1024"
8          defaultExpiration="900"
9          defaultAutoRefreshInterval="30" />
10    </aura:set>
11</aura:component>
name
The storage name must be actions. Storable actions are the only currently supported type of storage.
persistent
Set to true to preserve cached data between user sessions in the browser.
secure
Set to true to encrypt cached data.
maxsize
The maximum size in KB of the storage.
defaultExpiration
The duration in seconds that an entry is retained in storage.
defaultAutoRefreshInterval
The duration in seconds before an entry is refreshed in storage.

Storable actions use the Storage Service. The Storage Service supports multiple implementations of storage and selects an adapter at runtime based on browser support and specified characteristics of persistence and security.