GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Apps Script
  • All products
  • Admin console
  • Cloud Search
  • Gmail
  • Google Calendar
  • Google Chat
  • Google Classroom
  • Google Docs
  • Google Drive
  • Google Forms
  • Google Keep
  • Google Meet

This view

  • Original page
  • New address

GeezerVison is showing developers.google.com — Cache Service | Apps Script | Google for Developers

Cache Service Stay organized with collections Save and categorize content based on your preferences.

Spark icon

Page Summary

  • The Cache service allows a script to temporarily store results that take time to fetch or compute.

  • Public caches are for data not dependent on a specific user, while private caches are for user-specific information.

  • The Cache class represents a particular cache instance, and the CacheService class provides access to different caches.

  • The Cache class provides methods for getting, putting, and removing data from the cache, including setting expiration times and handling multiple key/value pairs.

  • The CacheService class provides methods to retrieve specific cache instances scoped to the document, script, or current user.

Cache

This service allows a script to temporarily cache results that take time to fetch/compute. Public caches are for things that are not dependent on which user is accessing your script. Private caches are for things which are user-specific, like settings or recent activity.

Classes

NameBrief description
CacheA reference to a particular cache.
CacheServiceCacheService allows you to access a cache for short term storage of data.

Cache

Methods

MethodReturn typeBrief description
get(key)String|nullGets the cached value for the given key, or null if none is found.
getAll(keys)ObjectReturns a JavaScript Object containing all key/value pairs found in the cache for an array of keys.
put(key, value)voidAdds a key/value pair to the cache.
put(key, value, expirationInSeconds)voidAdds a key/value pair to the cache, with an expiration time (in seconds).
putAll(values)voidAdds a set of key/value pairs to the cache.
putAll(values, expirationInSeconds)voidAdds a set of key/value pairs to the cache, with an expiration time (in seconds).
remove(key)voidRemoves an entry from the cache using the given key.
removeAll(keys)voidRemoves a set of entries from the cache.

CacheService

Methods

MethodReturn typeBrief description
getDocumentCache()Cache|nullGets the cache instance scoped to the current document and script.
getScriptCache()CacheGets the cache instance scoped to the script.
getUserCache()CacheGets the cache instance scoped to the current user and script.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-04-13 UTC.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.