Share via


Updating SharePoint Content Search Webpart (CSWP) Default Cache Duration

On a search driven SharePoint site, Content Search Web Parts are configured to use the Anonymous Search Results Cache. The Anonymous Search Results Cache stores results of a query, refinement data for the query, and additional result tables that are returned from the SharePoint Distributed Cache Service. Each cache entry depends on the parameters of a query, such as the sort order of the results, the requested refiners, and any dynamic reordering rules. The cache affects all queries that a web application handles including queries from Search Web Parts and the queries from CSOM clients.

This cache is not used for queries that are authenticated because of security concerns.

By default, the Anonymous Search Results Cache refreshes items every 15 minutes. The cache duration can be changed by updating the SharePoint web application property named "SearchResultsCacheTTLinSeconds" through the PowerShell.

$webapp = get-spwebapplication https://www.contoso.com$webapp.Properties["SearchResultsCacheTTLinSeconds"] = <number of seconds to keep in cache> $webapp.Update()

 

Note:

In order to enable a Content Search or a Catalog Item Reuse Web Part for Anonymous search results cache the configuration of that Web Part must have the TryCache property set to true.

Also ensure the DataProviderJSON property of the CSWP is configured with the TryCache:true