If you need to force flush blob cache in SharePoint, this script is for you! It will ensure that every file once cache will be deleted and will force SharePoint on recreating it when it sometimes becomes corrupt.
After running this script, you will get back on track and the cache will be flushed. But be cautious! This script will only affect the server where it’s being executed. In cases where you have multiple web application servers working together, the script must be executed in each server. It is necessary because each server holds its personal folder where the assets will be stored and cached.
The Blob Cache is an important feature that must be used when you have heavy traffic with lots of anonymous users, or even if you need to explore Image Renditions (we have a blog post about some problems there too). You can find over the internet a lot of content about it, but I must say that exists some undocumented stuff about the topic that may have been lost in the history and it’s just present in some old books about SharePoint.
The Script to force flush Blob Cache
All the steps below are important to get things working again. Basically our script will delete the Folder where you have configured the Blob Cache to store the files, then we will call the Flush Blob Cache method offered by the SPWebApplication object from SharePoint. Finally, the iisreset is an important step because it will ensure that the everything is rewinded and refreshed.
That’s it! I hope this script can help you getting things on track, perfoming a force Flush Blob Cache in SharePoint and serving a good SharePoint Site with awesome performance to your users.
Recent Comments