What is GAS's quota for cache service? It's missing from documentation.
https://developers.google.com/apps-script/guides/services/quotas
Google Ads scripts for advertiser accounts can execute for a maximum of 30 minutes, after which they will be cancelled. All of the changes made before the script was cancelled will be applied.
A single execution of Apps script can last no longer than 6 minutes and you're hitting this limit.
onEdit(e) The onEdit(e) trigger runs automatically when a user changes the value of any cell in a spreadsheet. Most onEdit(e) triggers use the information in the event object to respond appropriately. For example, the onEdit(e) function below sets a comment on the cell that records the last time it was edited.
The maximum execution time varies based on the type of your Google Account. If you are running your Apps Script code inside a Gmail account, your functions can run for 6 minutes before it will be terminated.
The following list details the aspects of Cache service that have limits.
Quote:
The maximum length of a key is 250 characters. The maximum amount of data that can be stored per key is 100KB. The value will expire from the cache after 600 seconds (10 minutes).
If you do not designate an expiration in seconds,then the default is 600 seconds.
put(key, value, expirationInSeconds)
There is a difference between quotas and limitations. Limitations are key length and value size. Quotas are how many times a day the service can be accessed.
put method - Apps Script Cache Service - reference
Service Quotas
Note that the value limit for one property in Properties Service is only 9kb, compared to 100 kb for Cache Service. Properties Service is similar, but not the same as Cache Service, and the value limits are different.
Other information:
A common error with all Apps Script services is that the service was invoked too many times.
For example:
Too many simultaneous invocations
There is a difference between too many times in a short period of time, or too many times in a 24 hour period. If, for example, you had lots of users all running your script at the same time, then your code would be calling services many times in a short period of time. If the code needs to run from your account, as opposed to the code running from the account of the user, then you might need to use something other than Apps Script.
If your code is structured so that it's making too many service calls, then you could optimize your code.
If the error is from to many service calls in a short period of time, then you can catch the error, have the code wait, and then retry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With