Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App script Cache service quota

What is GAS's quota for cache service? It's missing from documentation.

https://developers.google.com/apps-script/guides/services/quotas

like image 494
angelokh Avatar asked Apr 28 '15 22:04

angelokh


People also ask

How long can a Google script run for?

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.

How long can Apps Script run?

A single execution of Apps script can last no longer than 6 minutes and you're hitting this limit.

What is onEdit E?

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.

What is exceeded maximum execution time?

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.


1 Answers

The following list details the aspects of Cache service that have limits.

  • key length - 250 Characters
  • value size - 100kb
  • expiration time - default is 600 seconds
  • Number of times accessed in one day - no documented limit
  • Number of times accessed in a very short period of time - no documented limit
  • Number of total keys that can be used - Don't know of a documented limit

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:

  • Daily quotas are refreshed at the end of a 24-hour window

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.

like image 182
Alan Wells Avatar answered Sep 21 '22 15:09

Alan Wells