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.
Class: Cache
A reference to a particular cache.
| Method | Description | Return Type | Return Description | Status | Implementation |
|---|---|---|---|---|---|
| get(String) | Gets the cached value for the given key, or null if none is found. | String|null | The cached value, or null if none was found. | completed | link |
| getAll(String) | Returns a JavaScript Object containing all key/value pairs found in the cache for an array of keys. | Object | A JavaScript Object containing the key/value pairs for all keys found in the cache. | in progress | link |
| put(String,String,Integer) | completed | link | |||
| put(String,String) | completed | link | |||
| putAll(Object,Integer) | in progress | link | |||
| putAll(Object) | Adds a set of key/value pairs to the cache. | in progress | link | ||
| remove(String) | Removes an entry from the cache using the given key. | completed | link | ||
| removeAll(String) | Removes a set of entries from the cache. | in progress | link |
Class: CacheService
CacheService allows you to access a cache for short term storage of data.
| Method | Description | Return Type | Return Description | Status | Implementation |
|---|---|---|---|---|---|
| getDocumentCache() | Gets the cache instance scoped to the current document and script. Document caches are specific to the current document which contains the script. Use these to store script information that is specific to the current document. If this method is called outside of the context of a containing document (such as from a standalone script or web app), this method returns null. | Cache|null | A document cache instance, or null if there is no containing document. | completed | link |
| getScriptCache() | Gets the cache instance scoped to the script. Script caches are common to all users of the script. Use these to store information that is not specific to the current user. | Cache | A script cache instance. | completed | link |
| getUserCache() | Gets the cache instance scoped to the current user and script. User caches are specific to the current user of the script. Use these to store script information that is specific to the current user. | Cache | A user cache instance. | completed | link |