set blob disk cache on microsoft azure storage

1.3k Views Asked by At

i tried to set cacheControl value in azure CDN rules engine. request header is added with cacheControl value (cache-Control : max-age 3000), but when i reload my page, blob is not caching by disk cache and download blob everytime. is there have any other setting for blob disk cache? (blob's url is combine with SAS Token)

1

There are 1 best solutions below

0
On

To set blob cache on Microsoft Azure Storage (other than Azure CDN caching rules), please check the below methods:

Using Azure Storage Explorer

Open Azure Storage Explorer -> Select blob -> Select properties -> Go to cache control property -> Enter value as max-age=3000 -> Save.

Using Azure PowerShell

Use the Get-AzStorageBlob cmdlet to get blob, then set the .ICloudBlob.Properties.CacheControl property to "max-age=3000".

Using Azure CLI

In Azure CLI while uploading a blob, set the cacheControl property by using the -p switch like below.

azure storage blob upload -c <connectionstring> -p cacheControl="max-age=3000" .\<blob name> <container name> <blob name>

For more in detail, please refer this link.

Note :

Disk Caching is not supported for disks 4 TiB and larger. If multiple disks are attached to your VM, each disk that is smaller than 4 TiB will support caching. Changing the cache setting of an Azure disk detaches and re-attaches the target disk.

Please check these references if they are helpful:

Ref1, Ref2.