Try our conversational search powered by Generative AI!

Cache pagetree datasource?

Vote:
 
Hello, I have a menu that is created with help from the pagetree control. It takes approx 0.13 seconds to load and that is a little irritating since it is visible on all pages of the site. Is there a way to cache the content of a pagetree? I would like to throw the datasource to the .net cache and retrieve if from there. But I can't seem to get the datasource value. Any suggestions?
#12321
Jul 14, 2005 10:13
Vote:
 
You can add what every you want to the cache. So if you populate your three control from a PageDataCollection or similar you can cache the PageDataCollection like this: PageDataCollection theDataSource; theDataSource = CacheManager.Get("MyMenuDataSource"); if (theDataSource == null) // Was not in cache { //Fetch the data from somewhere theDataSource = GetMyPagesSomeHow(); CacheManager.Add("MyMenuDataSource" ,theDataSource ,System.Web.Caching.CacheItemPriority.Normal); } myTreeControl.DataSource = theDataSource; myTreeControl.DataBind(); The above code is from memory and untested, but with some tweaking it should work. By using EPiServer cache manager instead of accessing the ASP.NET cache directly you keep support for cache-invalidation on cluster configurations. But as EPiServer aleady caches page data in its DataFactory class I suspect you won't gain much by caching the data source. Propably it's the creation of the HTML for the three itself that takes time. But I thought that the HTML output cache would take care of that. You have output caching enabled?
#14052
Jul 14, 2005 14:50
Vote:
 
This is very usable if you have to use FindPagesWithCriteria in a static manner, since it does not seem to utilize caching. Question... Is it safe to use System.Web.Caching.CacheItemPriority.NotRemovable? It's still flushed with the cache object gets dirty (pages become obsolete), right?
#14053
Oct 26, 2005 22:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.