Unable to use <inp2:st_CachedMenu on large (over 4000) category count (while only 20 in menu)

瀏覽次數:5 次
跳到第一則未讀訊息

Alexander Obuhovich

未讀,
2012年6月11日 上午9:42:342012/6/11
收件者:In-Portal Bugs
Main difference between current In-Portal 5.x and In-Portal 4.3.9 is integrated In-Edit module.

This allowed to have more control over CMS part of In-Portal and provided huge possibilities such as:
  • content revision tracking
  • browse mode
  • drag-n-drop support of theme elements
  • almost inline phrase editing right inside a theme

To get that we needed to create a category for each template file in each theme, that is used on a website. We actually store ALL 4000 categories in cache (and not only these 20, which are usually in menu) to solve problem when you call st_CachedMenu tag with category_id parameter, which isn't in menu, but all it's child categories are.

That's why we cache ALL categories and then only display ones, that have IsMenu mark.

There might be more elegant solution, like this:
  1. get all categories, that have IsMenu (usually no much)
  2. get ParentPath of all categories, that were selected on previous set
  3. create multi-dimensional array where we'll have all IsMenu categories to be displayed grouped by their parent categories
  4. some categories will only have 1 child category because one of it's children have IsMenu categories, but category on it's own isn't displayed in menu.
Sounds pretty interesting optimization. Would speed up menu cache building (if you have many categories) very much.


--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com

Alexander Obuhovich

未讀,
2012年7月2日 上午9:49:012012/7/2
收件者:In-Portal Bugs
Here are the patch, ready for testing.

I've also did some benchmark of new and old ways of menu cache building. Here are measurements for test case, when 10 categories of 4000 are in menu:

Before:
  • Cache building time: 4 seconds
  • Data amount in cache: 2MB
After:
  • Cache building time: 0.05 seconds
  • Data amount in cache: 7KB
menu_cache_rebuild_optimization.patch

Dmitry A.

未讀,
2012年7月6日 凌晨1:36:002012/7/6
收件者:in-port...@googlegroups.com
Nice improvement.

DA
回覆所有人
回覆作者
轉寄
0 則新訊息