Google应用服务 - 缓存服务缺失条目 [英] Google apps service - Cache service missing entries

查看:99
本文介绍了Google应用服务 - 缓存服务缺失条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的Google Apps Script代码。该脚本没有任何错误地运行。但我发现有些条目缺失。数据已被清理,因此没有条目具有控制字符。是否有通过putAll方法填充的Cache对象的大小限制?如果我做个人放置方法,它工作正常。但这样运行需要很长时间。使用putAll只需要1-2分钟。请帮助我花了几天的时间来弄清楚这个问题。我是100%肯定的,数据没有错。谢谢

  //我的数据文件如下所示,包含180K条目。 
//每行以\
// {
//0000000001:Seattle,
//0000000002:Portland,
//0000000006:Tukwila,
//0000000008:Kirkland,
// ....
//}

var jsonString = DriveApp.getFileById(xxxxxx .... xxx)。getAs(MimeType.PLAIN_TEXT).getDataAsString();

var jsonObject = eval((+ jsonString +));

vendorCache.putAll(jsonObject,21600); // 21600缓存6小时


解决方案

但是如果我做了整个文件--178K左右,第101条记录就消失了。

这可能是因为看着 putAll(values)指出putAll方法有100KB的限制:


putAll(值)

250个字符。每个密钥可存储的
数据的最大数量为100KB。这些值将在600秒(10分钟)之后从
缓存到期。



I am using Google Apps Script code below. The script ran without any errors. But I've discovered that some entries are missing. The data has been cleaned up so no entries have control chars. Is there size limitation of Cache object populated through putAll method?. It works fine if i do individual put method. But It takes too long to run that way. Using putAll takes only 1 - 2 minutes. Please help I've spent days to figure out this issue. I am 100% positive there is nothing wrong with the data. THANKS

//my data file looks like below with 180K entries. 
//Each line is terminated with \n
//{
// "0000000001": "Seattle",
// "0000000002": "Portland",
// "0000000006": "Tukwila",
// "0000000008": "Kirkland",
// ....
// }

var jsonString = DriveApp.getFileById("xxxxxx....xxx").getAs(MimeType.PLAIN_TEXT).getDataAsString();

var jsonObject = eval("(" + jsonString +")");

vendorCache.putAll(jsonObject, 21600); // 21600 cache it for 6 hours

解决方案

But if I do the whole file - 178K or so the 101th record disappear.

This may be happening because looking at the putAll(values) states that the putAll method has a 100KB limit:

putAll(values)

The maximum length of a key is 250 characters. The maximum amount of data that can be stored per key is 100KB. The values will expire from the cache after 600 seconds (10 minutes).

这篇关于Google应用服务 - 缓存服务缺失条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆