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 currently building api to update and retrieve content. everything is working great.
the issue is that after I'm updating a content document I can see the updated values in the back office
but when I retrieve the content problematically I get the old values for about 15 minutes then it is updated (or after I rebuild the project)
it looks like it is something to do with cache, but I can't work it out I tried to use
library.UpdateDocumentCache(content.Id);
or
library.RefreshContent();
after I updated the values but it is not working
** I just discovered something very strange, when I use
Guid contentId ApplicationContext.Current.Services.ContentService.GetById(contentId)
I get the old values of the content
and when I use
int contentId ApplicationContext.Current.Services.ContentService.GetById(contentId)
I get the updated values
I really don't understand :(
Hi Ronen
How did you save the documents?
Can you show all your code?
Thanks,
Alex
<XmlContentCheckForDiskChanges>False</XmlContentCheckForDiskChanges>
Change in umbracoSettings.config to true
https://our.umbraco.org/documentation/reference/config/umbracosettings/
thanks for you reply but it didn't do the job,
I even tried to disable the cache
and it didn't changed the situation
the only thing that helped is that I replaced the call from
var content = ApplicationContext.Current.Services.ContentService.GetById(contentKey); //contentKey is the guid documet key
to
int contentId = ApplicationContext.Current.Services.EntityService.GetIdForKey(contentKey, (UmbracoObjectTypes)Enum.Parse(typeof(UmbracoObjectTypes), "Document", true)).Result;
var content = ApplicationContext.Current.Services.ContentService.GetById(contentId); //contentId is the integer documet id
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
content update with UmbracoApiController
I currently building api to update and retrieve content. everything is working great.
the issue is that after I'm updating a content document I can see the updated values in the back office
but when I retrieve the content problematically I get the old values for about 15 minutes then it is updated (or after I rebuild the project)
it looks like it is something to do with cache, but I can't work it out I tried to use
library.UpdateDocumentCache(content.Id);
or
library.RefreshContent();
after I updated the values but it is not working
** I just discovered something very strange, when I use
Guid contentId ApplicationContext.Current.Services.ContentService.GetById(contentId)
I get the old values of the content
and when I use
int contentId ApplicationContext.Current.Services.ContentService.GetById(contentId)
I get the updated values
I really don't understand :(
Hi Ronen
How did you save the documents?
Can you show all your code?
Thanks,
Alex
Change in umbracoSettings.config to true
https://our.umbraco.org/documentation/reference/config/umbracosettings/
thanks for you reply but it didn't do the job,
I even tried to disable the cache
and it didn't changed the situation
the only thing that helped is that I replaced the call from
var content = ApplicationContext.Current.Services.ContentService.GetById(contentKey); //contentKey is the guid documet key
to
int contentId = ApplicationContext.Current.Services.EntityService.GetIdForKey(contentKey, (UmbracoObjectTypes)Enum.Parse(typeof(UmbracoObjectTypes), "Document", true)).Result;
var content = ApplicationContext.Current.Services.ContentService.GetById(contentId); //contentId is the integer documet id
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.