DEV Community

Justin Poehnelt for Google Workspace Developers

Posted on • Originally published at justin.poehnelt.com

Apps Script CacheService Eviction and Other Limits

I recently explored the limits of the CacheService in Apps Script and here is the gist of what I found:

Feature Computed Limit Behavior
Key Length 250 characters Strict. Throws error if exceeded.
Value Size 100KB (102,400 bytes) Strict. Throws error if exceeded.
Eviction Policy FIFO Removes items based on creation time, ignoring recent access. Removes ~100 items (10%) at once when full.
Edge Cases Permissive Coerces types to strings. Negative expiration is ignored/stored.

The interesting part is the cache eviction (FIFO) which appears to eventually evict after the 1000 items but will clear approximately 10%. Read more of the details in my analysis of CacheService.

You might also be interested in my post on key value stores for Apps Script.

Top comments (0)