Returns a cache private to the current user.
class CacheService method .getUserCache()
CacheService is the Apps Script service.
.getUserCache() is the method name you will see after a dot in your code.
What it does
Why it's used
- Cache per-user dropdown data without hitting an API every open.
- Speed up sidebars that fetch personal lists.
Common errors
- Forgetting parentheses on getUserCache. Write CacheService.getUserCache(), not CacheService.getUserCache or getUserCache by itself.
- Skipping dots between chained calls. Each step needs a dot, like CacheService.getUserCache().
- Adding spaces where they do not belong. Write CacheService.getUserCache(), not CacheService .getUserCache(), CacheService.getUserCache (), or CacheService . getUserCache().
- Wrong capitalization. Use CacheService and getUserCache, not cacheservice or getusercache.
Explore
Related methods
-
.getScriptCache()
Returns a cache shared by all users of the script.
-
.get()
Reads a cached value by key.
-
.getDocumentCache()
Returns a cache tied to the current spreadsheet or doc.
-
.remove()
Deletes a cached value by key.
-
.put()
Stores a value in the cache for a set time.
More Apps Script
Better Sheets tutorials
No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.