Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set expiry limit for blob

I'm using Azure-Storage for storing information like a cache mechanism. So, for given input I'm doing the job for first time and after that I'll save the result in the cache for further use. When I'll need to solve the problem with same given input, I'll get it directly the already ready solution from storage. This all is implemented.

I'm trying to add a expiry limit for file in my cache. Each result will be stored for maximum 30 days. After that, they will be automatically deleted.

The naive solution is to implement also an background worker that will run one time per day and will run over all files and delete them, according to their creation time.

There are better solution?

like image 758
No1Lives4Ever Avatar asked Mar 03 '15 19:03

No1Lives4Ever


People also ask

How do I enable blob versioning?

To enable blob versioning for a storage account in the Azure portal: Navigate to your storage account in the portal. Under Blob service, choose Data protection. In the Versioning section, select Enabled.

What is the default retention period for blob soft delete?

The default retention period is seven days, but you can retain data for up to a year. In any case, you will have to click the Save button when you are done, to complete the process of enabling Soft Delete.

Is blob storage persistent?

The blob storage option is not persistent, as opposed to other Azure storage options like hard disks of Infrastructure-as-a-Service (IAAS) or VMs. As a result, you have to use persistent stores like tiers for long-term storage of files. There are three types of storage tiers.


2 Answers

We don't currently have automatic expiration for blob storage. To your point you could use something like WebJobs to run a background task to delete files. If you have a large number of files that you create each day a simpler approach could just be to create a new container each day and store the blobs created each day in that container - then each day you just delete the container that is 31 days old. You could also do something similar with Tables whereby you create a new Table each day - and then delete the Table that is 31 days old.

like image 71
Jason Hogg - MSFT Avatar answered Oct 20 '22 23:10

Jason Hogg - MSFT


I landed here from Google, so I'm leaving this for future readers. Microsoft currently has Blob Storage lifecycle management in public preview.

like image 37
DavidP Avatar answered Oct 20 '22 22:10

DavidP