You need to sign in to do that
Don't have an account?

AuraStorage:init is not holding data for more then 6,7 seconds
Hi all,
My component code:-
<aura:set attribute="auraPreInitBlock">
<auraStorage:init debugLoggingEnabled="true"
name="actions"
persistent="false" secure="true"
clearStorageOnInit="true"
defaultExpiration="3600"
maxSize="10485760" version="1.0"/>
</aura:set>
On the client side controller :-
doInit:function(cmp, evt, helper){
// Get server-side action
var action = cmp.get("c.fetchDataRecord");
action.setCallback(cmp, function(response){
var returnValue = response.getReturnValue();
});
// Set server-side action as storable
action.setStorable();
// Run server-side action
$A.enqueueAction(action);
},
I played with all attribute maxsize, defaultExpiration but nothing is working out.
If anybody has came across same senario please help.
Many thanks in Advance!!
My component code:-
<aura:set attribute="auraPreInitBlock">
<auraStorage:init debugLoggingEnabled="true"
name="actions"
persistent="false" secure="true"
clearStorageOnInit="true"
defaultExpiration="3600"
maxSize="10485760" version="1.0"/>
</aura:set>
On the client side controller :-
doInit:function(cmp, evt, helper){
// Get server-side action
var action = cmp.get("c.fetchDataRecord");
action.setCallback(cmp, function(response){
var returnValue = response.getReturnValue();
});
// Set server-side action as storable
action.setStorable();
// Run server-side action
$A.enqueueAction(action);
},
I played with all attribute maxsize, defaultExpiration but nothing is working out.
If anybody has came across same senario please help.
Many thanks in Advance!!
Please set the expiration parameter (instead of defaultExpiration), everything starts to work as expected. For example, if you want to hold the data for 10 minutes then use something like below. By declaring the above aura will store your data for ten minutes.
Please mark this as best answer if it's resolved.
Best Regards,
Nagendra.P
Thanks for the reply! But I already tried using expiration instead of defaultExpiration it is not allowing me to save the component then.
Please find the attachment.
Thanks Again!!
Check with the below information which might help you a bit in accelerating further.
http://salesforce.stackexchange.com/questions/108570/error-field-integrity-exception-failed-to-save-undefined-no-type-named-apex-t
Best Regards,
Nagendra.P
My org is not having the namespace issue, but the thing is expiration attribute is not there for <aura:auraStorage:init. Please refer the below link.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_auraStorage_init.htm
I too saw some of the link to resolve the problem but unfortunately I unable to do it, and in documentation also it is not clear. Below are some of the link I am refering but couldn't able to achieve it.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_auraStorage_init.htm
http://stackoverflow.com/questions/38434097/aura-storage-keeps-data-for-a-few-seconds-should-keep-for-a-long-time/39663045#39663045
Thanks Again!!
Please check below links and let me know if they were helpful
- https://developer.salesforce.com/docs/atlas.en-us.202.0.lightning.meta/lightning/storage_init.htm
- https://developer.salesforce.com/forums/?id=906F0000000kChYIAU
Hope this helps.Best Regards,
Nagendra.P
- Yes, I have visited these links as well. I visited many links but still couldn't able to implement it.
Follow the link and see the code behind auraStorage:init and create your own component to store data.
https://github.com/forcedotcom/aura/tree/master/aura-components/src/main/components/auraStorage/init