The events are fired according to action done in the Back-Office, no problems.
However in the handler of these events, I need to access the node's url or browse the content tree but I discovered some strange behaviors :
when creating a content, the new node was not present in the tree
when modifying a content's name/url, the node in the tree had the previous name/url
when deleting a content, the node was still present in the tree
As I found out, most of the API I called like UmbracoContext.Current.ContentCache.GetById() or UmbracoHelper.NiceUrl() are dependent on informations that are cached. Cache that, when the event is fired, is being refreshed asynchronously.
I tried to call UmbracoContext.Current.ContentHasChanged() with no effect since the subsequement implementation seems empty. Therefore I tried to wait in the handler and about 4 seconds later, the cache is effectively refreshed.
However that's really a hit or miss technique, especially since I believe that the refresh time will grow as my data grow. Therefore how can I synchronize with the cache end update ?
Well no luck, I tried to hook-up on the Document events but those are not fired at all. Because this class is obsolete I believe (I forgot to precise that I'm using the 7.1.8 version).
These are the events I have used to hook-up on the content being published or unpublished. Still there is no event related to the cache refreshing status described in this document.
This event fires when the cache related to the content is affected. And I can see that this event sometimes is fired after the Published / UnPublished.
However with that I think I will be able to synchronize my process.
PS : it exists other "CacheRefresher" dedicated to each node type like MediaCacheRefresher for the Media and such. Look-up into the Umbraco.Web.Cache namespace.
How to know when content/media cache has been refreshed
Hello,
I want to use the content/media service's events to do additionnal tasks after a node is published or unpublished.
The events are fired according to action done in the Back-Office, no problems.
However in the handler of these events, I need to access the node's url or browse the content tree but I discovered some strange behaviors :
As I found out, most of the API I called like UmbracoContext.Current.ContentCache.GetById() or UmbracoHelper.NiceUrl() are dependent on informations that are cached. Cache that, when the event is fired, is being refreshed asynchronously.
I tried to call UmbracoContext.Current.ContentHasChanged() with no effect since the subsequement implementation seems empty. Therefore I tried to wait in the handler and about 4 seconds later, the cache is effectively refreshed.
However that's really a hit or miss technique, especially since I believe that the refresh time will grow as my data grow. Therefore how can I synchronize with the cache end update ?
Thanks and regards,
Eric.
Hi Eric,
I am not a backend developer but maybe this overview of events can help you. I hope that you can use these in Umbraco 7 too.
http://our.umbraco.org/documentation/reference/Events/Document-Events
Hope this helps,
/Dennis
Hello Dennis,
Interesting I'll give it a shot.
Thanks.
Well no luck, I tried to hook-up on the Document events but those are not fired at all. Because this class is obsolete I believe (I forgot to precise that I'm using the 7.1.8 version).
Hi Eric,
Okay maybe this documentation can help you further, http://our.umbraco.org/documentation/reference/ the Events says for 6+
Hope this helps,
/Dennis
Hello Dennis,
These are the events I have used to hook-up on the content being published or unpublished. Still there is no event related to the cache refreshing status described in this document.
However I was able to find my grail :
This event fires when the cache related to the content is affected. And I can see that this event sometimes is fired after the Published / UnPublished.
However with that I think I will be able to synchronize my process.
PS : it exists other "CacheRefresher" dedicated to each node type like MediaCacheRefresher for the Media and such. Look-up into the Umbraco.Web.Cache namespace.
Thanks,
Eric.
Hi Eric
The direct links for ContentService events is here http://our.umbraco.org/documentation/reference/Events-v6/ContentService-Events and the direct links for the MediaService link is here http://our.umbraco.org/documentation/reference/Events-v6/MediaService-Events
Cheers, Jan
is working on a reply...