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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745473591a4629243.html
评论列表(0条)