Skip to content

Instantly share code, notes, and snippets.

View ChrisBaker97's full-sized avatar

Chris Baker ChrisBaker97

View GitHub Profile
@ChrisBaker97
ChrisBaker97 / ChunkyCache.gs
Last active February 4, 2022 05:35 — forked from pilbot/ChunkyCache.gs
Using the Google Apps Script Cache Service for objects above 100Kb
function ChunkyCache(cache, chunkSize){
chunkSize = chunkSize || 100*1024;
return {
put: function (key, value, timeout) {
var json = JSON.stringify(value);
var cSize = Math.floor(chunkSize / 2);
var chunks = [];
var index = 0;
while (index < json.length){
cKey = key + "_" + index;