Set expiry limit for blob

[亡魂溺海] 提交于 2019-12-01 14:55:15

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/28840249/set-expiry-limit-for-blob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!