Set expiry limit for blob

2020-04-03 04:22发布

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?

2条回答
家丑人穷心不美
2楼-- · 2020-04-03 04:57

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

查看更多
forever°为你锁心
3楼-- · 2020-04-03 05:04

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.

查看更多
登录 后发表回答