admin quizzes menu item should be cached

Sean B Fuller - October 11, 2006 - 16:49
Project:Quiz
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:rfolk
Status:closed
Description

The admin's "quizzes" menu item disappears sometimes because it is being defined in the !$may_cache area of the hook_menu. It is also not listed on the menu page. It is a cacheable menu item and should be in that section for consistency.

#1

rfolk - October 12, 2006 - 21:05
Assigned to:Anonymous» rfolk
Status:active» needs review

The admin's "quizzes" menu is now being defined in the $may_cache area of the hook_menu.

AttachmentSize
quiz_cachemenu 7.82 KB

#2

rfolk - October 12, 2006 - 21:13
Status:needs review» needs work

Sorry... wrong patch.

AttachmentSize
quiz_cachemenu2 761 bytes

#3

rfolk - October 12, 2006 - 21:22
Status:needs work» needs review

Please disregard the previous posts. Attached is the actual patch. Sorry about any confusion.

AttachmentSize
quiz_cachemenu3.patch 1.2 KB

#4

Sean B Fuller - October 12, 2006 - 21:26

Thanks Rachael! Sorry that the project issue interface was giving you are hard time. :)

#5

nicholasThompson - October 12, 2006 - 21:50

Maybe I misinterpreted the concept of the may_cache section - I thought it referred to the contents of the page.

Why would the menu item dissapear/appear based on your currently location in the site if it was in !$may_cache?

The reason I put it in the not cache area is because its a dynamic admin page - we dont want it to cache. But I'm getting the feeling I have really misinterpreted the point of $may_cache...

#6

Sean B Fuller - October 12, 2006 - 22:19

As I understand it, "cache" here refers to the menu array. Menu items are not cached if they have dynamic arguments (such as node/$nid or user/$uid) as these have to be created on the fly. The menu array is only rebuilt when saving the modules list page and the settings page. Additionally, cached menu items (paths) have positive menu ids, whereas dynamic menu paths have negative ids. Cached menus are held in the globals vars.

Page caching takes a snapshot of the page and dumps it into the cache table.

I think some queries are also cached, such as node_load(). This allows drupal to make one sql query to get node data instead of all the nodeapi load queries, etc.

There may be more, but that's how I understand it. Multiple types of performance enhances that are all referred to as "caching" at various times.

#7

nicholasThompson - October 12, 2006 - 22:24

Ah right - so $may_cache applies to the menu item itself, not the page! I know that pretty much everything gets cached at some point or another, but I thought may_cache applied to the page not the menu.

You explanation makes sense though.

#8

Sean B Fuller - October 12, 2006 - 23:13
Status:needs review» fixed

Committed

#9

Anonymous - October 26, 2006 - 23:15
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.