2016-09-16 80 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); 
} 

回答