簡體   English   中英

有沒有一種方法可以使用Table(azure-storage)客戶端API使用CosmosDb設置項目級別TTL(生存時間)?

[英]Is there a way to set item level TTL(Time-To-Live) with CosmosDb utilizing the Table (azure-storage) client API?

我正在將CosmosDb用於項目,並且首先嘗試使用Document-db java SQL API。 使用該API,我可以在文檔本身上設置項目級TTL。 防爆。

Document document = new Document(new Gson().toJson(testObject));
    document.setTimeToLive(10); // Time to live 10 seconds
    documentClient.createDocument(documentCollection.getSelfLink(), document, null,
        false).getResource();

但是,我也對使用Table API感興趣。 我在文檔中找不到有關設置項目級TTL的任何內容。 https://docs.microsoft.com/zh-cn/azure/cosmos-db/table-storage-how-to-use-java我正在使用https://github.com/Azure/azure-storage-java版本8.0.0 https://mvnrepository.com/artifact/com.microsoft.azure/azure-storage

是否可以這樣做,或者至少為表中的所有項目設置服務器端TTL? 謝謝!

如今,Table API並未公開任何TTL功能,因此,即使Cosmos支持該功能,您也無法將TTL與Table API一起使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM