Set expiration limit for blob

I use Azure-Storage to store information, such as a caching mechanism. So, for this input, I do the work for the first time, and after that I will save the result in the cache for future use. When I need to solve a problem with the same input, I get it directly from a ready-made solution from the repository. All this is implemented.

I am trying to add an expiration limit for a file in my cache. Each result will be stored for a maximum of 30 days. After that they will be automatically deleted.

The naive solution is to implement also a working background that will run once a day and will work on all files and delete them in accordance with their creation time.

Is there a better solution?

+6
source share
1 answer

We currently do not have an automatic memory expiration. At your time, you can use something like WebJobs to run a background task to delete files. If you have a large number of files that you create every day, a simpler approach can only be to create a new container every day and store blobs created every day in this container - then every day you just delete the container, which is 31 days , You can also do something similar with tables in which you create a new table every day, and then delete the table, which is 31 days.

+8
source

Source: https://habr.com/ru/post/983276/


All Articles