Amazon dynamodb 根据日期从dynamodb中删除项目

Amazon dynamodb 根据日期从dynamodb中删除项目,amazon-dynamodb,dynamo-local,Amazon Dynamodb,Dynamo Local,我是dynamodb的新手,我能够根据密钥删除一个项目 下面是代码片段: HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>(); key.put("hash", new AttributeValue().withS("hashEncodedStringValue")); DeleteItemRequest deleteItemRequest = new DeleteItem

我是dynamodb的新手,我能够根据密钥删除一个项目

下面是代码片段:

HashMap<String, AttributeValue> key = new HashMap<String, AttributeValue>();
key.put("hash", new AttributeValue().withS("hashEncodedStringValue"));

DeleteItemRequest deleteItemRequest = new DeleteItemRequest().withTableName("HashTable").withKey(key);
HashMap key=newhashmap();
key.put(“hash”,新的AttributeValue().with(“hashEncodedStringValue”);
DeleteItemRequest DeleteItemRequest=新的DeleteItemRequest().withTableName(“哈希表”).withKey(键);

我需要从我的表中删除7天以内的项目。我的表格有一个名为“created_at”的字段,格式为“2017-10-25 14:54:52.278”

如果您希望dynamodb在7天后自动删除它,您可以创建TTL字段并更新时间戳,dynamodb将自动删除它

参考资料:

使用Java执行CRUD操作:

希望能有帮助