A BLOB cache is a disk-based cache that stores binary large objects (BLOBs) such as frequently used image, audio, and video files, and other files that are used to display Web pages. Each front-end Web server maintains its own BLOB cache. When you enable a BLOB cache, you specify the file types to include in the cache and also the location of the BLOB cache. The first time that a BLOB file is requested, the file is copied from the database to the BLOB cache on the front-end Web server. Future requests to the front-end Web server for that same file are then served from the file that is stored in the BLOB cache, instead of being served from the database. This reduces the network traffic and the load on the database server. (ref: http://technet.microsoft.com/en-us/library/gg277249.aspx)The BLOB cache needs to specify in the web.config for each web application. By default, the BLOB caching is disabled in web.config. Open the web.config for the web application that you need to configure the BLOB cache. Normally you find the following line in the web.config of the web application:
<BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="false" />You can modify the following attributes:
location – the path to the directory where the blob files stores in the disk.
path – specifies the condition for file names that will be included in the cache. By default SharePoint will include a regular expression that matches certain extensions. In most of the cases you just need to add/remove some extensions to the list.
maxSize – the maximum size for the cache expressed in GB, 10 GB is the default
enabled - specifies whether blob cache is enabled or not. True indicates enabled
Following points should also be kept in consideration with BLOB caching:
- All front end web serves should have the BLOB caching enabled with same configuration
- BLOB Caching works only for items in SharePoint libraries
- Changes in CSS, JS etc., might not reflect immediately. If such a case occurs then the option is to flush the cache by navigating to the site collection's Site Settings. Select "Site Collection Object Cache" and then click "Force this server to reset its disk based cache."
- You can also make use of the following PowerShell commands to flush the BLOB cache:
$webApp = Get-SPWebApplication "<WebApplicationURL>"
[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)Write-Host "Flushed the BLOB cache for:" $webApp