2

How to disable output caching for site pages?

I tried disabling output caching from Site settings but I could not see any output caching in the Site setting collection administration menu, even in publishing infrastructure mode.

I want to know how I could make this change with PowerShell. I also want to disable caching on the page level.

   //I tried this on a page but it rises an error:
   <%@ OutputCache Location="None" %>

How can this be done?

3
  • are you site collection admin? which version of sharepoint you are using? is it publishing site or site with publishing feature active? try to browse this page: sitecolelction url/_Layouts/sitecachesettings.aspx
    – Waqas Sarwar MVP
    Aug 27, 2014 at 11:59
  • thanks all caching are disabled to me : but the problem happen to me always why the Xsltlistviewwebpart dipslaying Splist Items could not Refresh or display the SList View in real time but cache me the last view items any idea.
    – ezzaam
    Aug 27, 2014 at 12:58
  • i am not sure about it.
    – Waqas Sarwar MVP
    Aug 27, 2014 at 12:59

1 Answer 1

1

A SharePoint Publishing site can also be configured to make use of the ASP.NET output cache to store rendered ASPX pages in memory. You can only make use of this cache when the P**ublishing features are activated on your site collection. This means that only publishing pages can be cached.

User must be a site collection administrator or have full control within web application policy to modify this settings.

Here is code to disable it:

Param($Url)

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Publishing”)
$cacheSettings = new-object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($Url); 
$cacheSettings.EnableCache = $true; 
$cacheSettings.Update();

Save the file as DisableOutputCache.ps1 and run like this

powershell "& ./DisableOutputCache.ps1 -Url http://dev-moss.com"

http://blog.mediawhole.com/2010/05/disable-output-cache-programmatically.html

http://karinebosch.wordpress.com/my-articles/improving-performance-of-sharepoint-sites/part-4-output-caching-in-sharepoint-2010/

2
  • i did that i found it thanks a lot all caching settings are disabled but the problem still with XsltListViewWebPart
    – ezzaam
    Aug 27, 2014 at 13:01
  • 1
    why is $cacheSettings.EnableCache = $true; Disable cache? shouldn't it be $cacheSettings.EnableCache = $false; ?
    – user25682
    Jun 19, 2015 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.