Google Apps Script

Cache Service

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.

Class Cache

Methods

MethodReturn typeBrief description
get(key)StringGets 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.

Class CacheService

Methods

MethodReturn typeBrief description
getPrivateCache()CacheGets the private cache instance for the script.
getPublicCache()CacheGets the public cache instance for the script.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.