Local Cache is like a temporary area where the App service can store all the content related to the App Service. So, instead of referring a shared location, the App Service stores all its content in each provisioned VM.
If the App Service is being configured in 2 VMs, all the content would be copied in both the VMs. As you can imagine, reading the content from the local copy is better than reading them from a shared location and as a result, there would a bit of improvement of the performance when we enable the “App Service Local Cache” feature.
So, in simple words, Azure App Service Local Cache is a copy of all the content located in “Site” and “Site Extensions” folder located in a local VM.
How to enable “Azure App Service Local Cache”?
Enable the feature by having the WEBSITE_LOCAL_CACHE_OPTION = Always as shown below.
- We must restart the App Service for each deployment to clear the local cache of each of the VMs.
- If you perform writes directly on the local store, you would lose all the changes whenever the VM is relocated or restarted.
- It’s created in the local VM on the startup of the App Service.
- The default memory allocated is 300 MB, but it is possible to extend it to 1 GB, but we need to set the following setting WEBSITE_LOCAL_CACHE_SIZEINMB to 1024.
- When the Virtual VM is re-located or the App Service is restarted, all the content in the Local Cache are cleared and its populated with the content available in the Shared Content, so take into account that all your previous job will be ERASED
- All deployments done by all different methods (FTP, Web Deploy etc.) will still be pointed to the Shared Content area. So, in order to get these changes reflected to the local cache, the App Service needs to be restarted in order to get the new changes reflected.