Hi Steve
I'm hoping you can help me getting the CacheItemName set for my CMSListMenu.
As you said earlier in this thread, the cache item name doesn't seem to be set if you put it in the codebehind.
I've tried the StopProcessing/ReloadData workaround you posted above, but still no joy.
If you have a moment, would you mind taking a glance over what I've done (below) and see if there's anything I'm forgetting or misunderstanding?
I have a CMSListMenu (ID="LeftTreeMenu") in my master page (Administration.master)
I would like this menu to be cached by role/page, on the understanding that that would mean only one cached copy would be stored of the menu content for each role for each page.
My menu is declared as follows
<uc1:cmslistmenu runat="server" ID="LeftTreeMenu" Path="/{0}/%" SelectOnlyPublished="true"
HighlightAllItemsInPath="true" MaxRelativeLevel="3" EnableViewState="false" CheckPermissions="true"
DisplayHighlightedItemAsLink="true" CacheMinutes="20" StopProcessing="true" />
In the Init() method of the Administration.master page, I have the following:
LeftTreeMenu.CacheItemName = GetCacheItemName(); //<== returns <site>_<page>_<controlID>_<role>
LeftTreeMenu.StopProcessing = false;
LeftTreeMenu.ReloadData();
object output;
LogManager logManager = new LogManager();
if (!CacheHelper.TryGetItem(LeftTreeMenu.CacheItemName, out output))
{
logManager.LogInfo("Menu for string {0} was not in cache", LeftTreeMenu.CacheItemName);
}
else
{
logManager.LogInfo("Menu for string {0} was in cache", LeftTreeMenu.CacheItemName);
}
That all looks sweet to me, but refreshing the page multiple times, the string is never found in the cache.
If I put some value in the ASPX, the key IS found in the cache.
Any idea what the problem might be?
Thanks very much