Caching the build JSON for an add-on page

456 views
Skip to first unread message

Paul Armstrong

unread,
Jul 4, 2022, 2:15:18 AM7/4/22
to Google Apps Script Community
Hi
When you build an add-on using AppScript, you use the CardService and CardBuilder factories to create Cards, Sections and other components. 
Once done, you execute the CardBuilder::build() which returns the Card, which in turn contains all of the other components. 

The Card, I assume, maintains a JSON version of the output via printJson(). See this tool for an example of the JSON I am talking about. https://gsao-card-builder.web.app/

I thought I could speed up the execution of a number of my pages by caching the original JSON and returning it instead of building it each time. The build is expensive based on several read writes I have to do elsewhere. I can, of course, cache the results of that IO, but if I could cache this JSON, it would be way simpler.

I appreciate any help you can provide.



Reply all
Reply to author
Forward
0 new messages