Rackspace CloudFiles:检查文件是否存在
我想通过 Rackspace Cloud API 通过我的站点代码检查 CDN 上是否存在文件。
最好的方法是什么?我目前正在使用以下内容:
... initialize API ...
Dim containerItemList As List(Of String) = connection.GetContainerItemList("MyCDN")
If containerItemList.Contains(MyFile) Then
'Blah blah
End If
由于某种原因,这不起作用 - containerItemList 始终为空。我的容器肯定有对象,并且容器的名称是正确的(包括大小写)。
有没有更好/不同的方法来搜索/检查文件是否存在?理想情况下,它应该是不区分大小写的搜索。
另一种方法是尝试使用 connection.GetStorageItem 之类的方法获取对象,并检查异常,但显然这会损害性能。
有什么想法吗?任何语言的代码都可以,我只是在寻找最好的方法来做到这一点。
提前致谢!
WT
I want to check for the existence of a file on the CDN through my site's code via the Rackspace Cloud API.
What would the best way to do this be? I am currently using the following:
... initialize API ...
Dim containerItemList As List(Of String) = connection.GetContainerItemList("MyCDN")
If containerItemList.Contains(MyFile) Then
'Blah blah
End If
This isn't working for some reason - the containerItemList is always empty. My container definitely has objects, and the name of the container is right (including case).
Is there a better/different way to search/check for the existence of a file? Ideally, it should be a case-insensitive search.
Another way would be to try and get the object using something like connection.GetStorageItem, and check for exceptions, but obviously that would hurt performance.
Any ideas? Code in any language would be fine, I'm just looking for the best way to do this.
Thanks in advance!
WT
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个错误,已由社区成员修复: https://github.com/rackspace/csharp-cloudfiles/issues/unreads#issue/6
This appears to be a bug, that was fixed by a member of the community: https://github.com/rackspace/csharp-cloudfiles/issues/unreads#issue/6