Trong bài viết How to use the Windows Azure Blob Storage Service in .NET mã sau đây được sử dụng để chứng minh như thế nào người ta có thể tải lên một tập tincache kết nối đến Azure Blob lưu trữ
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");
// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream = System.IO.File.OpenRead(@"path\myfile"))
{
blockBlob.UploadFromStream(fileStream);
}
Nếu bạn đã có một dịch vụ chạy lâu đã được chấp nhận tập tin và lưu trữ chúng trong blob lưu trữ, bạn sẽ thực hiện tất cả các bước này mỗi lần? Hoặc bạn có thể có một lớp học có tham chiếu đến blockBlob
đã được nhiều yêu cầu sử dụng không? Bao nhiêu (nếu có) của điều này là nó không sao để bộ nhớ cache và sử dụng từ nhiều yêu cầu? (mà tôi đoán có nghĩa là các chủ đề)
Tại sao tôi không đồng ý? https://www.youtube.com/watch?v=i5j1wWY-qus –