Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » When saving a page (based item), Dynamicweb.Content.PageService doesn't clear cache

When saving a page (based item), Dynamicweb.Content.PageService doesn't clear cache

Pete Surawatanapong
Reply

Hi DW,

In v9.2.8

In frontend:
Fx.
@{
var pageService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Content.IPageService>();
var page = pageService.GetPage(_thePageIdFromOuterScope_);
}
<div>@((string)page.Item["TheProperty"])</div>

The result might be:
<div>Hello!</div>


The issue:
If I re-save in /admin with a difference value. The page.Item["TheProperty"] is still "Hello!" at frontend.
The cache at PageService is not reset.


The workaround:
I have this code to call:
if (Dynamicweb.Context.Current.Request["clearcaches"] == "1") {
    var pageService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Content.IPageService>();
    pageService.ClearCache();
}

Can the cache at PageService be reset every time, when saving a page in /admin?
Because it's not optimal for the end-user to append "&clearcaches=1" in the url just to reset the cache


Replies

 
Kevin Steffer
Kevin Steffer
Reply

yes​ we experience the same, fix needed!

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Pete and Kevin

The problem with clear cache has been fixed in version 9.2.9 #31955

You are able to find this build in the download section:

http://doc.dynamicweb.com/releases-and-downloads/releases

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum