Is there a way to force a refresh of the cached file?

We’re working on building a system which allows end users to create their own content using sharp pages which will be stored in S3. Under normal circumstances, we want to utilize a long cache. But during active development and subsequent release to production, we want to somehow force a refresh of that updated sharp page. Is this possible?

Get a reference to the SharpPage then call Load() on it, e.g:

public ISharpPages Pages { get; set; }

//...

var page = Pages.GetPage(virtualPagePath);
await page.Load();

Note for remote backing store there are a couple of properties to control page invalidation as described in the pure AWS Cloud App. These are configurable on your Script Context (e.g HostContext.AssertPlugin<SharpPagesFeature>()) at Context.CheckForModifiedPagesAfter and Context.Context.InvalidateCachesBefore properties.

So you should be able to “force a re-check” for all pages modified after certain date with:

Context.InvalidateCachesBefore = DateTime.UtcNow;

Where if it detects the backing file has been modified it will also reload it.

Great! We’ll give this a shot.