AI OnAI Off
ContentRepository is cached and you probably don't have to worry. All things adds up in the end though, so if you do a lot of recursion, you might want to cache the result. You can cache the object with depedencies to all ancestors, or just a the global cache key for when any content changes.
I have a requirement to display Alerts on a website. Alerts should be defined at a parent page level, and cascade down to all child pages. Alerts may be defined on the homepage, on a landing page, or on an individual detail page. Only one alert should be displayed at a time.
I've come up with a solution that is working, but I fear I may have introduced a performance problem. My approach is a bit naive, but here's what I've done:
Here's the rough pseudocode of my logic:
So I guess the real heart of my question is: is there a more efficient way to recurse through the page ancestry looking for the first instance of a page which has a non-empty content area? Are calls into the ContentRepository cached? Am I thinking about this problem in the wrong way?