Skip to content

SPBlobCacheSettings

dscbot edited this page Mar 17, 2023 · 19 revisions

SPBlobCacheSettings

Parameters

Parameter Attribute DataType Description Allowed Values
WebAppUrl Key String The URL of the web application
Zone Key String The zone of the web application for which blob cache has to be configured Default, Intranet, Internet, Custom, Extranet
EnableCache Required Boolean Specify if the blob cache has to be enabled
Location Write String The location where the blob cache has to store its files
MaxSizeInGB Write UInt16 The maximum size (in GB) of disk space the blob cache is allowed to use
MaxAgeInSeconds Write UInt32 The maximum age (in seconds) that a browser caches a blob
FileTypes Write String Specify the file types that must be stored by the blob cache

Description

Type: Specific Requires CredSSP: No

This resource is used to configure the Blob Cache settings for a web application.

Important: This resource only configures the local server. It changes the web.config file directly and is NOT using the SPWebConfigModifications class. In order to configure all WFE servers in the farm, you have to apply this resource to all servers.

NOTE: In order to prevent inconsistancy between different web front end servers, make sure you configure this setting on all servers equally. If the specified folder does not exist, the resource will create the folder.

Best practice: Specify a directory that is not on the same drive as where either the server operating system swap files or server log files are stored.

Examples

Example 1

This example shows how to configure the blob cache settings on the local server for the specified web application and zone

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPBlobCacheSettings BlobCacheSettings
        {
            WebAppUrl            = "http://intranet.contoso.com"
            Zone                 = "Default"
            EnableCache          = $true
            Location             = "F:\BlobCache"
            MaxSizeInGB          = 10
            FileTypes            = "\.(gif|jpg|png|css|js)$"
            PsDscRunAsCredential = $SetupAccount
        }
    }
}
Clone this wiki locally