设计模式以使cloudant上的文档过期

编程入门 行业动态 更新时间:2024-10-22 08:06:29
本文介绍了设计模式以使cloudant上的文档过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因此,当删除文档时,元数据实际上会永久保留。对于像cloudant这样的托管服务,每月需要支付存储费用,我想彻底清除已删除的文档。

So when a document is deleted, the metadata is actually preserved forever. For a hosted service like cloudant, where storage costs every month, I instead would like to completely purge the deleted documents.

我读过某处关于设计模式的地方,您在其中使用 dbcopy ,以将文档放入当前数据库,然后定期删除过期的db。但是我找不到这篇文章,而且我不太了解数据库命名的工作原理。 cloudant客户端将如何始终知道当前数据库名称?

I read somewhere about a design pattern where you use dbcopy in a view to put the docs into a 'current' db then periodically delete the expired dbs. But I cant find the article, and I don't quite understand how database naming would work. How would the cloudant clients always know the 'current' database name?

推荐答案

Cloudant不公开_purge端点(宽松的一致性)

Cloudant does not expose the _purge endpoint (the loose consistency guarantees between the clustered nodes make purging tricky).

此问题最常见的解决方案是创建第二个数据库,并使用带有validate_document_update的复制,以便删除没有目标数据库中的现有条目将被拒绝。复制完成后(如果使用连续复制,则为最新状态),将您的应用程序切换为使用新数据库并删除旧数据库。当前无法重命名数据库,但是您可以使用指向当前数据库的虚拟主机。

The most common solution to this problem is to create a second database and use replication with a validate_document_update so that deleted documents with no existing entry in the target database are rejected. When replication is complete (or acceptably up-to-date if using continuous replication), switch your application to use the new database and delete the old one. There is currently no way to rename databases but you could use a virtual host which points to the "current" database.

我警告说,工作负载会产生很高的负担。删除:活动文档的比例通常是Cloudant中的反模式。我首先考虑是否可以更改文档模型来避免这种情况。

I'd caution that a workload which generates a high ratio of deleted:active documents is generally an anti-pattern in Cloudant. I would first consider whether you can change your document model to avoid it.

更多推荐

设计模式以使cloudant上的文档过期

本文发布于:2023-10-30 04:28:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541767.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式   文档   cloudant

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!