Newer Version Available

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

Initializing Storage Service

Initialize storage in your app’s template for caching server-side action response values.

Initialize in Markup

This example uses a template to initialize storage for server-side action response values. The template contains an <auraStorage:init> tag that specifies storage initialization properties.

1<aura:component isTemplate="true" extends="aura:template">
2    <aura:set attribute="auraPreInitBlock">
3        <!-- Note that the maxSize attribute in <auraStorage:init> is in KB -->
4        <auraStorage:init name="actions" persistent="false" secure="false"
5             maxSize="1024" version="1.0"/>
6    </aura:set>
7</aura:component>

When you initialize storage, you can set certain options, such as the name, maximum cache size, and the default expiration time.

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.

The expiration time for an item in storage specifies the duration after which an item should be replaced with a fresh copy. The refresh interval takes effect only if the item hasn’t expired yet and applies to the actions storage only. In that case, if the refresh interval for an item has passed, the item gets refreshed after the same action is called. If stored items have reached their expiration times or have exceeded their refresh intervals, they’re replaced only after a call is made to access them and if the client is online.