The application I developed basically allows users to upload contents and get stored in Azure Blob Storage.
Since the nature of the contents are for quick sharing between users, many of the contents are quickly become untouched after a period of time. But for some contents can be used over and over again.
In order to stop the unprecedented growth of the size of blob storage, I am planning to write tool that basically find any blobs that aren't used for period of time and delete them off the storage.
If it was standard file system, I can use "Last Access Time" to indicate when the last time file being used. However, I can't seem to find similar property of the blob to determine Last Access Time.
So does anyone ever come across this situation, what would be the best way to achieve this?
Or am I too concerned about this?
Any feedback or suggestion are greatly appreciated.
Thank you in advanced.
I can only see two ways of handling this:
If you are using Blob storage then following the approach that Gaurav suggested is your best option. See here for a doc on getting started:
Note that our .NET client libraries do include support for parsing log files - you can see a demo of this in our client library unit tests:
You can use block and page blob Properties.LastModifiedUtc to get the last modified date. With Page or Block blob, you would need to use GetBlockBlobReference or GetPageBlobReference API along with FetchAttributes() to get the blob reference and then you can look for LastModifiedUtc.
For example with Block blob here is the code snippet:
CloudBlockBlob blockBlob = container_name.GetBlockBlobReference(uri.ToString()); blockBlob.FetchAttributes(); // blockBlob.Properties.LastModifiedUtc will return the last modified date for the blob.