获取最后一滴湛蓝中Blob存储 [英] Get last blob in azure blob storage

查看:166
本文介绍了获取最后一滴湛蓝中Blob存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道我怎么能找回我的Blob存储最后创建的BLOB。现在,我用做它的循环,但在目录中有大约50000的 blockblobs 的。

I need to know how I can retrieve the last created blob in my blob storage. Now I'm doing it with a for loop, but there are approximately 50000 blockblobs in the directory.

我怎样才能得到一个有效的方式最后创建的块斑?

How can I get the last created block blob on a efficient way?

我的code是如下:

string url = null;
foreach (var blobItem in subdir.ListBlobs())
{
    url = blobItem.Uri.ToString();
}
url += signature;
if (url != pictureBoxLiveViewer.ImageLocation)
{
    pictureBoxLiveViewer.ImageLocation = url;
}

这是一个计时器谁的滴答每分钟的功能。因此,这是低效的。

This is a function in a timer who's ticking every minute. So this is inefficient.

推荐答案

我已经创建了我的上传应用程序的功能,将每一次写最新的图像的完整URI在一个文本文件(TXT)

I have created a function in my upload application that will write every time the full URI of the newest image in a text file (txt)

CloudBlobClient blobClient = new CloudBlobClient(
    sUrl, new StorageCredentialsSharedAccessSignature(signature));
CloudBlobContainer container = blobClient.GetContainerReference(container1);
CloudBlobDirectory dir = container.GetDirectoryReference(cameranaam);
CloudBlob cloudBlob = dir.GetBlobReference(cameranaam+".txt");
cloudBlob.UploadText(blobSAS.Uri.ToString());

这是我是谁装的服务器的最后一个影像其他项目的计时器:

And this is the timer of my other project who is loading the last image of the server:

blobClient = new CloudBlobClient(
    blobstoreurl, new StorageCredentialsSharedAccessSignature(signature));
container = blobClient.GetContainerReference(containerName);
CloudBlobDirectory dir = 
    container.GetDirectoryReference(comboBoxCameras.SelectedItem.ToString());
CloudBlob cloudBlob = dir.GetBlobReference(
    comboBoxCameras.SelectedItem.ToString().Replace(" ","") + ".txt");
pictureBoxLiveViewer.ImageLocation = cloudBlob.DownloadText() + signature;

这篇关于获取最后一滴湛蓝中Blob存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆