我对 couchbase 中的用户使用了一个月的 TTL,并在本月内每次看到用户时都使用“touch”更新此 TTL。
例如,我需要检查用户的 TTL,以便在他们变老时执行特殊操作。
我无法在对象中使用“updated_at”字段,因为它不会通过触摸方法进行更新,而且我更喜欢使用触摸来最大程度地减少服务之间的交互以解决性能问题。
这可以做到吗?
最佳答案
目前还不可能。
来自 couchbase 论坛的回答:https://forums.couchbase.com/t/how-can-i-get-the-metadata-of-a-couchbase-object-in-node/13630 :
Unfortunately it is not currently possible to reliably fetch the current TTL of an item. The upcoming Couchbase Server release should be able to fetch this information using a new virtual attribute fetch, but this was not yet available in currently released versions. In the meantime, we do suggest performing a subdocument upsert to update a field within the document with an updated timestamp.
关于node.js - 如何获取 Node 中 couchbase 对象的元数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45328053/