I have a scenario where each page of a site has a checkbox for "is in header" and "is in footer". The universe of items that needs to be traversed is a couple of hundred in nature, and I'm looking for the most efficient way to retrieve them.
Currently, I'm using foreach loops, but there's four levels of hierarchy I need to go through, so going through the children of each is not the most efficient method and takes a few seconds per page load. I've got caching on the rendering going, but while that hides the issue, it doesn't solve it from a code perspective.
I've been looking at Sitecore Query and the like as an option as well. I know fast query won't work because the data won't maintain its hierarchy, but I also see that Sitecore Query is slow. Also, I read that using Axes.Descendants and the like is slow as well.
One thought I had was to read the entire tree into a single object and cache it with .NET caching, but then there's an issue of security rights for a particular user...you'd need to use the SecurityDisabler to get the whole universe, then when outputting it somehow compare the logged-in user to the tree and exclude anything they don't have read rights to.
The last option might work, if someone can point me in that direction for manually checking if a user has rights to an item. Beyond that, does anyone have a suggestion for running this efficiently?