有没有人对 Windows azure 上的缓存控制有一些经验。我只是无法让它工作。我有一个 JSON 文件,我想要一些缓存规则。我有以下代码:
var matchContainer = _blobClient.GetContainerReference(match.ClassContainer);
matchContainer.CreateIfNotExists();
matchContainer.SetPermissions(new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
// save the blob into the blob service
string uniqueBlobName = string.Format("matchdata/" + match.KeyPath + ".json").ToLower();
CloudBlockBlob blob = matchContainer.GetBlockBlobReference(uniqueBlobName);
var matchString = match.ToString();
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.AutoFlush = true;
writer.Write(matchString);
stream.Seek(0, SeekOrigin.Begin);
blob.UploadFromStream(stream);
blob.Properties.CacheControl = "max-age=3600, must-revalidate";
blob.SetProperties();
这与此处的示例完全相同 设置 Cache-Control的示例
标题只是没有设置。希望你能帮忙。