2013-08-11 2 views
0

Windows Azure에서 캐시 제어에 대한 경험이있는 사람이 있습니까? 나는 그걸 작동시킬 수 없다. 일부 캐싱 규칙을 원하는 JSON 파일이 있습니다.Azure Blob, 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(); 

여기 Sample of setting Cache-Control

단지 설정되지 않습니다 헤더를 통해 정확하게 샘플과 동일하다 : 나는 다음과 같은 코드가 있습니다. 당신이 도울 수 있기를 바랍니다.

+0

헤더가 표시되지 않는 것을 확인하려면 무엇을 사용하고 있습니까? 위에서 붙여 넣은 코드를 사용했습니다 (일치 객체가없는 일부 값만 바꾸기 만하면됩니다). 제대로 작동했습니다. 헤더가 Azure Management Studio를 사용하여 설정되었고 피들러를 사용하여 요청하는 동안 반환되었음을 확인했습니다. – MikeWo

+0

저는 Azure Storage Explorer를 사용하여 업로드 결과를 확인하고 피들러를 사용하여 요청/응답을 확인합니다. 요청에 캐싱 정보가 없습니다. 요청은 ($ ajax (..., caching = true ...) 응답은 Cache-Control을 비공개로 설정합니다. (지정된 설정이 아님) – markwilde

+0

Ai, 내 질문을 다시 말해야합니다. .WindowsAzure.Com 캐시 제어가 올바르게 설정되면 문제는 Azure가 다른 헤더를 반환하는 것입니다. – markwilde

답변

0

Windows 8.1 미리보기에서 피들 (fiddle)을 사용하는 경우 캐시에 항상 도달하지 않는 것으로 나타났습니다. 내 블로그 게시물의 캐시 히트를 확인하기 위해 크롬을 사용해야했습니다.

알렉스

관련 문제