2016-09-16 59 views
2

我有一个包含大量自定义函数调用的工作表。我想永久缓存结果。 到现在为止,我已经使用了缓存服务,但限于六个小时。 有没有办法永久缓存结果? 我在评论here中读到,可以在用户的​​浏览器中缓存数据。我应该如何实现这一目标?Google Apps脚本 - 永久缓存

谢谢!

编辑: 感谢哔叽亨德里克斯的建议,我是能够永久使用相同的方法作为高速缓存服务的缓存结果:

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); 
} 

回答