Newer Version Available
Storable Actions
Successful actions, for which getState() in the JavaScript callback returns SUCCESS, are stored.
If a storable action is aborted after it’s been sent but not yet returned from the server, its return value is still added to storage but the action callback is not called.
The action response of a storable action is saved in an internal framework-provided storage named actions. This stored response is returned on subsequent calls to the same server-side action instead of the response from the server-side controller, as long as the stored response hasn't expired.
If the stored response has reached its expiration time, a new response is retrieved from the server-side controller and is stored in the actions storage for subsequent calls.
Enable Storable Actions for Apps
Server-side actions storage is the only currently supported type of storage. Storage for server-side actions caches action response values. The storage name must be actions.
For an example of initializing storage for an app, see Initializing Storage Service.
Marking Storable Actions
To mark a server-side action as storable, call setStorable() on the action in JavaScript code, as follows.
1action.setStorable();The setStorable function takes an optional parameter, which is a configuration map of key-value pairs representing the storage options and values to set. You can only set the following property:
- ignoreExisting
- Set to true to refresh the stored item with a newly retrieved value, regardless of whether the item has expired or not. The default value is false.
To set the storage options for the action response, pass this configuration map into setStorable().