// so far so good, not runtime errors or so, contentCache is not null
var count = contentCache.GetAtRoot().Count();
// count = 0 // it seems empty
// in other context, for ex in a controller, same site will contain count=2, in our case
// have also tried to get specifik cached content like contentCache.GetById(1234); this is null
}
What is the easiest way to get access to this cached content in this context? In Umbraco 8 version of this, there were no problems getting access to an populated instance of IPublishedContentCache ( when inherit from RecurringTaskBase )
IPublishedContentCache inside RecurringHostedServiceBase?
Hi,
I'm trying to get access to the cached content inside an RecurringHostedServiceBase.
It does not seem to work by doing like
public class MyTask : RecurringHostedServiceBase
public MyTask( ...IUmbracoContextFactory umbracoContextFactory... ) { this.umbracoContextFactory = umbracoContextFactory; } ...
public override async Task PerformExecuteAsync(object state) { IPublishedContentCache contentCache = this.umbracoContextFactory.EnsureUmbracoContext().UmbracoContext.Content;
// so far so good, not runtime errors or so, contentCache is not null
var count = contentCache.GetAtRoot().Count();
// count = 0 // it seems empty
// in other context, for ex in a controller, same site will contain count=2, in our case
// have also tried to get specifik cached content like contentCache.GetById(1234); this is null
}
What is the easiest way to get access to this cached content in this context? In Umbraco 8 version of this, there were no problems getting access to an populated instance of IPublishedContentCache ( when inherit from RecurringTaskBase )
Thanks in advance :)
Did you ever find an answer to this issue?
is working on a reply...