Question about resetting cache on publish

Mar 11, 2015 at 9:52 PM
Edited Mar 11, 2015 at 9:53 PM
Hello Jeff,

wow. Thanks a lot for sharing this great module. My sites are heavily using taxonomy menu entries and menu creation took too much time. With this cache, performance is greatly improved.

Regarding resetting the cache e. g. for OnPublished eventd:
is this really necessary for all published events? Would it be possible to do this only for
  • menu content item changes
  • content items that create/change menu items
  • taxonomy terms modifications
    ?
One of my sites has lots of users that create content. Some type of content gets auto-published which, if I understand it correctly, will always lead to resetting your cache.
Coordinator
Mar 11, 2015 at 11:21 PM
Yes, Taxonomy menus are intense. I actually have an internal task here to look into taxonomy performance as I use them heavily myself and they seem to be one of the slower elements in Orchard (though they are very useful).

As for resetting the cache, I have tried a number of different events to try to limit when the cache would be reset. Here are my notes in my local version as to why I eventually went back to IContent:

// Need to reset the navigation cache (to have the menus rebuilt)
// - Utilizing IContent because it is extremely difficult (possibly impossible) to determine what content item actually has an impact on the navigation
// - I had tried to utilize just MenuPart but this eventually caused errors to creep up in the caching because content would be published
// - and the deep clone would not be re-initiated against the content items which were trying to impact the menus

So as of today I have not found a viable option. The other thing is that I don't want to have it be dependent on a ton of modules (i.e. Taxonomies, Lists, whatever is next) as it somehow needs to stand on it's own without knowing what module a user will use. This is why I initially tried using MenuPart events but I am pretty sure that the MenuPart is sometimes updated WITHOUT throwing an event. This should not be of course as then other developers like myself cannot capture the event, but I am pretty sure this is what eventually caused me to go back to using IContent.

I cannot agree more that there should be a better way. I am open to suggestions or code.
Mar 11, 2015 at 11:31 PM
Thanks for your quick Feedback.

I agree that the module should not be dependant of too many other modules and I also see there is not a better suitable Event.
Basically, I do the auto-publish for the user right now because of another issue (https://orchard.codeplex.com/workitem/21142). I will try to find a solution for this issue and will prevent too many Navigation cache resets with that.