gpt4 book ai didi

ibm-cloud - 什么是 cloudant 文档过期字段?

转载 作者:行者123 更新时间:2023-12-04 12:45:02 25 4
gpt4 key购买 nike

文档过期字段是否设置为日期时间、秒或毫秒?
据我所知,这是几秒钟:

"expiration": 1543086426,

所以 1543086426 = Saturday, November 24, 2018 7:07:06 PM
那么为什么文档会被 Cloudant 删除呢?
如果是毫秒,则:
1543086426 =  Sunday 18 January 1970 12:38:06

这解释了。那么如何为 cloudant 文档设置适当的到期值,例如1 个月后?

另外,哪个 Cloudant 任务负责文档删除?它多久开始?

最佳答案

正如 CouchDB 文档中指出的那样

Time to live (TTL) is the amount of time until a document expires in Couchbase Server. By default, all documents have a TTL of zero, which indicates the document is kept indefinitely. Typically when you add, set, or replace information, you establish a custom TTL by passing it as a parameter to your method call. As part of normal maintenance operations, Couchbase Server periodically removes all items with expiration times that have passed.

Depending on the amount of time you want to specify for the document to live, you provide a TTL value as a relative number of seconds into the future or in Unix time . Unix time represents a specific date and time expressed as the number of seconds that have elapsed since Thursday, 1 January 1970 at 00:00:00 Coordinated Universal Time (UTC) . For example, the value 1421454149 represents Saturday, 17 January 2015 at 00:22:29 UTC.



但是,Cloudant 不支持生存时间功能。

原因是 IBM Cloudant 文档只是“软”删除,而不是删除。软删除涉及用较小的记录替换原始文档。这个小记录或“墓碑”是复制所必需的;它有助于确保在复制期间可以识别要使用的正确修订。

如果 TTL 功能在 IBM Cloudant 中可用,那么由此产生的短期文档和软删除记录的潜在增加将意味着数据库大小可能会以无限制的方式增长。

有关更多信息,请参阅此 link on TTL

关于ibm-cloud - 什么是 cloudant 文档过期字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52996810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com