Skip to content

Instantly share code, notes, and snippets.

View lahirue's full-sized avatar

Lahiru J Ekanayake lahirue

View GitHub Profile
@lahirue
lahirue / ChunkyCache.gs
Created March 14, 2020 13:56 — forked from pilbot/ChunkyCache.gs
Using the Google Apps Script Cache Service for objects above 100Kb
function ChunkyCache(cache, chunkSize){
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;
chunks.push(cKey);
@lahirue
lahirue / ChunkyCache.gs
Created March 14, 2020 13:56 — forked from pilbot/ChunkyCache.gs
Using the Google Apps Script Cache Service for objects above 100Kb
function ChunkyCache(cache, chunkSize){
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;
chunks.push(cKey);