admin管理员组文章数量:1429759
I have a sheet with a lot of custom functions calls. I would like to cache results permanently. Until now, I've used cache service, but it is limited to six hours. Is there a way to cache results permanently ? I read in the ments here, that it could be possible to cache data in the user's browser. How should I achieve this ?
Thanks !
Edit : Thanks to Serge Hendrickx's suggestion, I was able to cache results permanently using the same approach as cache service :
var scriptProperties = PropertiesService.getScriptProperties();
if(getCachedVariable(variableName) == null){
// Results aren't in cache, get them and save them
scriptProperties.setProperty(variableName,value);
}
return getCachedVariable(variableName);
function getCachedVariable(variableName){
return scriptProperties.getProperty(variableName);
}
I have a sheet with a lot of custom functions calls. I would like to cache results permanently. Until now, I've used cache service, but it is limited to six hours. Is there a way to cache results permanently ? I read in the ments here, that it could be possible to cache data in the user's browser. How should I achieve this ?
Thanks !
Edit : Thanks to Serge Hendrickx's suggestion, I was able to cache results permanently using the same approach as cache service :
var scriptProperties = PropertiesService.getScriptProperties();
if(getCachedVariable(variableName) == null){
// Results aren't in cache, get them and save them
scriptProperties.setProperty(variableName,value);
}
return getCachedVariable(variableName);
function getCachedVariable(variableName){
return scriptProperties.getProperty(variableName);
}
Share
Improve this question
edited May 23, 2017 at 12:06
CommunityBot
11 silver badge
asked Sep 16, 2016 at 10:29
StandaaStandaa
1,9202 gold badges28 silver badges45 bronze badges
1 Answer
Reset to default 7This might not be exactly what you're looking for but why not store the results in the Properties Service? This storage is permanent. You could check if the result is already in storage, and potentially store the age of the 'cache' in there as well.
https://developers.google./apps-script/reference/properties/properties-service
本文标签: javascriptGoogle Apps ScriptPermanent CachingStack Overflow
版权声明:本文标题:javascript - Google Apps Script - Permanent Caching - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745473591a2659859.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论