Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have an interface helper which gets some site settings from node in Umbaco.
For some reason when I update the settings it doesn't refresh the IPublishedContentCache. I think there is either some delay on it or it requires me to restart my app.
private readonly IUmbracoContextFactory _umbracoContextFactory;
public SiteHelper(IUmbracoContextFactory umbracoContextFactory)
_umbracoContextFactory = umbracoContextFactory;
public SiteSettings GetSiteSettings()
using (UmbracoContextReference umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
IPublishedContentCache contentHelper = umbracoContextReference.UmbracoContext.Content;
siteSettings = contentHelper.GetById(1114) as SiteSettings;
I am ensuring the contact because this might be used in some hangfire events and other places where it might need this.
Does anyone know if there is a way to force refresh the IPublishedContentCache? I am thinking I can use an composer.
I know how to set the composer / event up on publish but I am just wanting the line of code that will refresh the cache.
Thanks in advanced.
Wow so even stranger.
So I have my helper class. ISiteHelper siteHelper
This contains my method GetSiteSettings
My SurfaceController has ISiteHelper denendency injection.
When I get the site settings within my SurfaceController they are correct and seem to update find when I change the node within Umbraco.
Here is the strange part...
I then have an email service IEmailService. This gets used in my SurfaceController to send a specific email. Nothing too special
The email requires some site settings so my IEmailService has has ISiteHelper denendency injection.
When I use the ISiteHelper within my email service to get the site settings they are different.
It appears that when I make the changes in Umbraco they get updated in my controller but the service still sees the old cache.
This is very strange because both examples are using the same ISiteHelper, same method which should be looking at the same data.
There is no mistake here and I have triple checked. I have compared all this in the watch window.
Has anyone got any ideas at all why it would act like this?
As a fix I am going to get my SiteSettings in the SurfactController since this is working and pass then into the service method rather than relying on DI within my service.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted