getScriptCache availability when script is a web app

319 views
Skip to first unread message

Irfan Alam

unread,
Aug 7, 2019, 6:21:09 AM8/7/19
to Google Apps Script Community
I wrote a script and published it as web app having doPost.
When the script is called, it get data from Google Sheet and store it in the getScriptCache service

1. My question is if the web app script is called again from same or different user will the cache data will be available which was stored previously?

2. There is a function in the web app script that is called every 4 hours to update the cache. Will the updated cache data be available if the web app is called by same or different user?

Bruce Mcpherson

unread,
Aug 9, 2019, 12:01:30 PM8/9/19
to Google Apps Script Community
There are 3 caches
script cache - shared between every user of the script
user cache - specific to a user of the script
document cache - specific to a document 

You can set the ttl (time to live) when you write the item to cache, so 4 hours would be possible.
If you use script cache, all users of that script will be able to have access to it for as long as it lives.


The caveat is that cache is not guaranteed to live for its entire lifetime as it depends on resources available at the time, although in my experience, cache is not generally evacuated early
Reply all
Reply to author
Forward
0 new messages