Flush the BLOB cache (SharePoint Server 2010)

 

Applies to: SharePoint Server 2010

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.

For more information about BLOB caches, see Plan for caching and performance (SharePoint Server 2010).

Flush the BLOB cache

When you flush the BLOB cache, you clear the contents of the BLOB cache for a Web application. This is useful if the BLOB cache becomes out of sync with the content. For example, after you restore a content database, the BLOB cache will be out of sync with the content. To correct that situation, you must flush the BLOB cache. The following procedure describes how to flush the BLOB cache for a Web application.

Warning

Flushing the BLOB cache for a Web application affects all site collections in the Web application.

Note

You cannot use the user interface to flush the BLOB cache. Instead, you use Windows PowerShell and the SharePoint object model to complete this task.

To flush the BLOB cache

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. Copy the following code and paste it into a text editor, such as Notepad.

    $webApp = Get-SPWebApplication "<WebApplicationURL>"
    [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
    Write-Host "Flushed the BLOB cache for:" $webApp
    
  3. Replace <WebApplicationURL> with the URL of the Web application whose BLOB cache you want to clear.

  4. Save the file, and name it FlushBLOBCache.ps1.

    Note

    You can use a different file name, but you must save the file as an ANSI-encoded text file that has the file name extension .ps1.

  5. On the Start menu, click All Programs.

  6. Click Microsoft SharePoint 2010 Products.

  7. Click SharePoint 2010 Management Shell.

  8. Change to the directory where you saved the file.

  9. At the Windows PowerShell command prompt, type the following command.

    ./FlushBLOBCache.ps1
    

See Also

Other Resources

Running Windows PowerShell Scripts