javascript - Google Apps Script - Permanent Caching - Stack Overflow

I have a sheet with a lot of custom functions calls. I would like to cache results permanently. Until

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
Add a ment  | 

1 Answer 1

Reset to default 7

This 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

相关推荐

  • javascript - Google Apps Script - Permanent Caching - Stack Overflow

    I have a sheet with a lot of custom functions calls. I would like to cache results permanently. Until

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信