Google Apps Script

Class CacheService

CacheService allows you to access a cache for short term storage of data. This class lets you get a specific cache instance. 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.

Methods

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

Detailed documentation

getPrivateCache()

Gets the private cache instance for the script. Private caches are private to the current active user and script. They can be used to store information specific to that user.

 
// Gets a cache that is private to the current user
 var cache = CacheService.getPrivateCache();
 

Return

Cache — a private cache instance


getPublicCache()

Gets the public cache instance for the script. Public caches are common to all users of the script. Use these to store information that is not specific to the current user.

 
// Gets a cache that is common to all users of the script
 var cache = CacheService.getPublicCache();
 

Return

Cache — a public cache instance

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.