class CacheService method .put()

CacheService is the Apps Script service.

.put() is the method name you will see after a dot in your code.

What it does

Stores a value in the cache for a set time.

Why it's used

  • Store API results for 10 minutes so repeats are instant.
  • Remember expensive calculations between trigger runs.

Common errors

  • Forgetting parentheses on put. Write CacheService.put(), not CacheService.put or put by itself.
  • Skipping dots between chained calls. Each step needs a dot, like CacheService.put().
  • Adding spaces where they do not belong. Write CacheService.put(), not CacheService .put(), CacheService.put (), or CacheService . put().
  • Wrong capitalization. Use CacheService and put, not cacheservice or put.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.