The last thing we will do is clean the Blob storage at regular intervals and delete photos that are older than 1 hour. We will do that by creating a function that is triggered by TimeTrigger. Proceed as follows:
- To create a new function, right-click the Chat.Functions project and click New Azure Function, which can be found under the Add menu.
- Name the function ClearPhotos.
- Select the option where the function will use a Timer trigger because we want it to run on a time interval.
- Use a CRON expression to make it run every 60 minutes. Set the Schedule to 0 */60 * * * *, as illustrated in the following screenshot:
If you want to read more about CRON expressions, you can do so by going to the following URL: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp#ncrontab-expressions
The only thing we will do in the ClearPhotos...