auraStorage:init

Initializes a storage instance using an adapter that satisfies the provided criteria.

Use auraStorage:init to initialize storage in your app’s template for caching server-side action response values.

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.

<aura:component isTemplate="true" extends="aura:template">
    <aura:set attribute="auraPreInitBlock">
        <!-- Note that the maxSize attribute in auraStorage:init is in KB -->
        <auraStorage:init name="actions" persistent="false" secure="false"
             maxSize="1024" />
    </aura:set>
</aura:component>
        

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

Storage for server-side actions caches action response values. The storage name must be actions.

Attributes

Attribute Name Attribute Type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
clearStorageOnInit Boolean Set to true to delete all previous data on initialization (relevant for persistent storage only).
debugLoggingEnabled Boolean Set to true to enable debug logging with $A.log().
defaultAutoRefreshInterval Integer The default duration (seconds) before an auto refresh request will be initiated. Actions may override this on a per-entry basis with Action.setStorable().
defaultExpiration Integer The default duration (seconds) that an object will be retained in storage. Actions may override this on a per-entry basis with Action.setStorable().
maxSize Integer Maximum size (KB) of the storage instance. Existing items will be evicted to make room for new items; algorithm is adapter-specific.
name String The programmatic name for the storage instance. Yes
persistent Boolean Set to true if this storage desires persistence.
secure Boolean Set to true if this storage requires secure storage support.
version String Version to associate with all stored items.