When the “Sliding Expiration” checkbox is disabled, the cache will expire after 2 minutes (or whatever duration is specified) - regardless of users hitting the page.
Depending on the type of data being rendered and how often users are visiting a page, these settings may be adjusted to accommodate. For instance, if sliding expiration is turned on for a high traffic page, it’s very unlikely that content will appear updated since users will likely always be on the page. If there’s a dynamic element to the data or UI being rendered, it will not be updated in this scenario. Having sliding expiration turned off is one way to remedy this type of page. However, it’s important to understand that if sliding expiration is off, the page will take a performance hit whenever it goes to fetch content every 2 minutes
Recently, we were dealing with a very custom site that had very long page cache durations set for most of their pages. The production environment was also not easily accessible to admin users. Additionally, there were many dynamic components to page widgets where it was useful to periodically clear a page’s cache to get the most updated content / HTML. For an experiment, and a somewhat useful tool, I thought it might be nice to have a tool that could programmatically clear a page’s output cache or blast the cache for all pages. Obviously, this tool would be restricted to admins only. After I did some digging, I was unable to find documentation or a resource that already did this. There is a small snippet somewhat documenting a similar feature, but I failed to implement it in a way that accomplished clearing a page’s output cache.After some back and forth with Sitefinity support, I was able to get a working service together that cleared a page’s output cache based on its PageData ID (Guid). Below is the method that takes the ID as a guide (provided from the PageData object) and then clears that page’s output cache.
This method can be utilized by any additional helpers and services for clearing any page or set of pages’ output cache in the event that you need to mass clear that stale html.